-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add blood vessel dataset processing script #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #184 +/- ##
==========================================
- Coverage 83.32% 83.20% -0.12%
==========================================
Files 83 83
Lines 3921 3924 +3
Branches 617 619 +2
==========================================
- Hits 3267 3265 -2
- Misses 520 522 +2
- Partials 134 137 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
tools/convert_datasets/drive.py
Outdated
osp.join(out_dir, 'images', 'validation', | ||
osp.splitext(img_name)[0] + '.jpg'), img) | ||
|
||
now_dir = osp.join(tmp_dir, 'test', '1st_manual') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, there is no '1st_manual' in the test dataset.
docs/getting_started.md
Outdated
|
||
### DRIVE | ||
|
||
The training and validation set of DRIVE could be download from [here](https://drive.grand-challenge.org/). Before that, you should registrate an account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, there is no '1st_manual' in the test dataset.
docs/getting_started.md
Outdated
To convert STARE dataset to mmsegmentation format, you should run the following command: | ||
|
||
```shell | ||
python tools/convert_datasets/hrf.py ~/stare-images.tar ~/labels-ah.tar ~/labels-vk.tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be stair.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah......yes, I will fix it.
tools/convert_datasets/chase_db1.py
Outdated
osp.splitext(img_name)[0] + '.jpg'), | ||
img[:, :, 0] // 128) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments about //128
.
mmcv.mkdir_or_exist(out_dir) | ||
mmcv.mkdir_or_exist(osp.join(out_dir, 'images')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not necessary.
The deepest level mkdir will automatically create them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that, I write this to make the code easy to understand.
docs/getting_started.md
Outdated
To convert HRF dataset to mmsegmentation format, you should run the following command: | ||
|
||
```shell | ||
python tools/convert_datasets/hrf.py ~/healthy.zip ~/healthy_manualsegm.zip ~/glaucoma.zip ~/glaucoma_manualsegm.zip ~/diabetic_retinopathy.zip ~/diabetic_retinopathy_manualsegm.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may omit ~
. We may use /path/to/healthy.zip
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
docs/getting_started.md
Outdated
|
||
### DRIVE | ||
|
||
The training and validation set of DRIVE could be download from [here](https://drive.grand-challenge.org/). Before that, you should registrate an account. Now, there is no '1st_manual' in the test dataset, if you need it, please search for it by yourself, we do not provide links to download. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The training and validation set of DRIVE could be download from [here](https://drive.grand-challenge.org/). Before that, you should registrate an account. Now, there is no '1st_manual' in the test dataset, if you need it, please search for it by yourself, we do not provide links to download. | |
The training and validation set of DRIVE could be download from [here](https://drive.grand-challenge.org/). Before that, you should register an account. Currently '1st_manual' is not provided officially. |
tools/convert_datasets/hrf.py
Outdated
osp.join(out_dir, 'annotations', 'validation', | ||
osp.splitext(filename)[0] + '.jpg'), | ||
img[:, :, 0] // 128) | ||
shutil.rmtree(tmp_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments about 128.
tools/convert_datasets/stare.py
Outdated
|
||
for filename in sorted(os.listdir(osp.join(tmp_dir, 'files')))[10:]: | ||
img = cv2.imread(osp.join(tmp_dir, 'files', filename)) | ||
cv2.imwrite( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all cv2.imwrite
, we may replace them with mmcv.imwrite
, which could also automatically create a directory.
tools/convert_datasets/chase_db1.py
Outdated
mmcv.mkdir_or_exist(osp.join(out_dir, 'annotations', 'training')) | ||
mmcv.mkdir_or_exist(osp.join(out_dir, 'annotations', 'validation')) | ||
|
||
tmp_dir = osp.join(out_dir, 'tmp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using system tmp instead of hard code 'tmp'. On the other hand, we may add an argument so that user could specify their own tmpdir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the "system tmp"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tools/convert_datasets/hrf.py
Outdated
mmcv.mkdir_or_exist(tmp_dir) | ||
zip_file = zipfile.ZipFile(now_path) | ||
zip_file.extractall(tmp_dir) | ||
for filename in sorted(os.listdir(tmp_dir))[:5]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct truncate 5 here is not very safe. We may have some check and assert.
tools/convert_datasets/hrf.py
Outdated
zip_file = zipfile.ZipFile(now_path) | ||
zip_file.extractall(tmp_dir) | ||
for filename in sorted(os.listdir(tmp_dir))[:5]: | ||
img = cv2.imread(osp.join(tmp_dir, filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmcv.imread
docs/getting_started.md
Outdated
|
||
The training and validation set of CHASE DB1 could be download from [here](https://staffnet.kingston.ac.uk/~ku15565/CHASE_DB1/assets/CHASEDB1.zip). | ||
|
||
To convert CHASE DB1 dataset to mmsegmentation format, you should run the following command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To convert CHASE DB1 dataset to mmsegmentation format, you should run the following command: | |
To convert CHASE DB1 dataset to MMSegmentation format, you should run the following command: |
tools/convert_datasets/hrf.py
Outdated
assert len(os.listdir(tmp_dir)) == HRF_LEN, \ | ||
'len(os.listdir(tmp_dir)) != {}'.format(HRF_LEN) | ||
|
||
for filename in sorted(os.listdir(tmp_dir))[:5]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard code in script is not ideal. We may add a variable at top like here
* Add blood vessel dataset processing script * Fix syntax error * Fix syntax error * Fix syntax error * Fix bugs * Fix bugs * Fix bugs * Use safe functions and expand more apis * Use safe functions and expand more apis * Fix hard code and verify dataset integrity
Co-authored-by: lizz <[email protected]>
Update README.md
* val * modify average_clips * support multi-batch * update * update docs * add changelog
No description provided.