-
Notifications
You must be signed in to change notification settings - Fork 79
730 retinal oct rpd segmentation #748
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
base: dev
Are you sure you want to change the base?
730 retinal oct rpd segmentation #748
Conversation
…files.yaml. Fixed case-sensitivity for .png/.PNG in dataset/data.py. Made confidence threshold an external argument.
… instructions in readme.
@yiheng-wang-nv here is my draft PR |
@@ -0,0 +1,3 @@ | |||
# ensure that using evironment with python==3.9 | |||
pip install -r ./docs/requirements.txt #includes monai | |||
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' |
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.
Hi @ybagdasa , could you fix the commit for the detectron2
installation?
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.
@yiheng-wang-nv Thanks for considering the contribution. For the detectron2 installation, what is the command I should run to replicate the error you're getting? I know that the install works for python<3.10. Could this be the source of the issue for the ci install checks?
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.
Hi @ybagdasa ,
For the comment of this line (python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
),
based on https://github.com/Project-MONAI/model-zoo/pull/748/files#diff-6d26dc7c0d9fa894d66c944bd9d0a7c970f95371163c70631b8d6b0ed790fc81R19 detectron2 0.6
is used, thus here we can modify the install command into:
python -m pip install 'git+https://github.com/facebookresearch/[email protected]'
Otherwise, the command will install the latest commit, which may have incompatible issues in the future.
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 the python version, can you confirm if python 3.9 is necessary?
I'm not 100% sure, but based on https://detectron2.readthedocs.io/en/latest/tutorials/install.html#requirements , it only requires to use python >= 3.7.
Currently, our repo uses python 3.10 in default for CI tests. If we do need python 3.9 for this bundle, I may consider some changes in the CI to support multiple python versions.
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 the CI error: https://github.com/Project-MONAI/model-zoo/actions/runs/14742610327/job/42137993317?pr=748#step:7:510 Let me push a commit to your branch to fix it. Since detectron2 cannot simply be installed via pip install detectron2
, we should consider some changes in:
https://github.com/Project-MONAI/model-zoo/blob/dev/ci/get_bundle_requirements.py#L54
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.
Since I don't have the permission to push to your forked repo directly, I pushed the changes into: https://github.com/Project-MONAI/model-zoo/tree/730-retinalOCT_RPD_segmentation, could you help to merge it?
The branch also fixed the pre-commit ci errors.
Then we can see if there are other issues in the dependencies.
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 the python version, can you confirm if python 3.9 is necessary? I'm not 100% sure, but based on https://detectron2.readthedocs.io/en/latest/tutorials/install.html#requirements , it only requires to use python >= 3.7.
Currently, our repo uses python 3.10 in default for CI tests. If we do need python 3.9 for this bundle, I may consider some changes in the CI to support multiple python versions.
My attempts to build the detectron2 wheel failed with python 3.10 and it unfortunately seems to be a common issue with their repo: facebookresearch/detectron2#5445
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.
Thanks, let me enable py3.9 in the CI
Hi @ybagdasa , thanks for the PR contribution. For |
Format test can be fixed according to: https://github.com/Project-MONAI/model-zoo/actions/runs/14742610314/job/42137993243?pr=748#step:7:67 |
I will look at this PR later this week |
@yiheng-wang-nv When running flake8 on the code it flags a lot of mixed-case naming conventions (N800 flags). A lot of the naming comes from the pycocotools api which used mixed-case naming for functions and variables. Having everything lowercase will probably hinder the readability of the code at this point. Is this a strict requirement or can I somehow skip it? |
@@ -0,0 +1,3 @@ | |||
# ensure that using evironment with python==3.9 | |||
pip install -r ./docs/requirements.txt #includes monai |
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 not need the requirements.txt file in the bundle, it's content is included in the metadata.json
.
Our CI can generate the requirements file directly via: https://github.com/Project-MONAI/model-zoo/blob/dev/ci/get_bundle_requirements.py#L54
Signed-off-by: Yiheng Wang <[email protected]>
Hi @ybagdasa , sorry I cannot see the error you mentioned, the error I saw is from |
…dical-ml/monai-model-zoo into 730-retinalOCT_RPD_segmentation
@yiheng-wang-nv |
Signed-off-by: Yiheng Wang <[email protected]>
Hi @ybagdasa , thanks for the updates and providing me the permissions. I pushed a commit to fix the black and pre-commit issues. Now, our CI can reach to the flake8 errors: https://github.com/Project-MONAI/model-zoo/actions/runs/15105923819/job/42454628204?pr=748 I think we can skip N802, N803 and N806 errors, but others may need to be solved |
Signed-off-by: Yiheng Wang <[email protected]>
Hi @ybagdasa , I updated, and could you help to resolve other issues? Like line too long (https://github.com/Project-MONAI/model-zoo/actions/runs/15106735909/job/42456940644?pr=748) |
@yiheng-wang-nv I was able to do ./runtests.sh up through pytype. The error popped up here: |
Hi @ybagdasa , thanks for the updates. The issue does not happen in github's workflow, thus we can ignore it (may due to different environment). I will help to solve the pre-merge CPU related issues this week, then this PR can be merged. |
Signed-off-by: Yiheng Wang <[email protected]>
"torchvision": "0.22.0", | ||
"detectron2": "0.6", | ||
"lxml": "5.4.0", | ||
"pillow": "9.5.0" |
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.
Hi @ybagdasa , I added the pillow requirement due to the issue: facebookresearch/detectron2#5010
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Hi @ybagdasa , I pushed some commits to enable building customized python environment for CI tests, and now For the |
Hi @ericspod , could you also help to review this new bundle contribution? Thanks in advance! |
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.
Hi @ybagdasa and @yiheng-wang-nv I've had a look through the contribution and had a few comments to make. I haven't tried running it but from the conversation it seems it's being tested a lot anyway so I'm sure that's fine. I am concerned that there's a lot of code here and very little actual bundle definition, this code is coming from existing sources so that's understandable as an adaptation into the bundle format. I would still suggest looking at how to reduce this code somehow by using existing libraries perhaps. It's not clear what a lot of the code does either and would benefit with a lot more commentary/docstrings in at least the top level definitions.
I see that Miniconda is being used in the tests now, I think I missed why this was. This required a number of changes to other test scripts so I wonder if it's needed. It might help to provide an environment.yaml file to define what environment to construct rather than rely on commands, this might clean up some of the logic.
The flake complaints relate to variable names as you see, I would suggest fixing these or using the ignore comments if you don't want to change this code vs. the original source.
Thanks!
.github/workflows/premerge-cpu.yml
Outdated
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.
Why are we using Miniconda for the tests now?
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.
Hi @ericspod , this bundle requires python 3.9, but our current CI workflows use python 3.10, we did not meet python version requirements thus did not consider it in CI before. Therefore, I made the changes to enable customized python version support via using conda. What do you think?
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.
On this issue thread for detectron2 installation with python 3.10, it looks like using setuptools==75.8.0 works for some. Would this be compatible with the current CI workflow?
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 would really recommend doing what's necessary to make this compatible with later versions of Python. Version 3.9 won't be in support for much longer and we should be keeping all bundles running on current platforms. Please do look into the issue with the setuptools dependency and see what else we can do to not depend on that specific version.
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.
@ericspod I want ahead and added setuptools==75.8.0 to the required packages in metadata.json. I tested the build on python 3.10 and everything seems to install and run. I do get a DEPRECIATION warning from pip now, but I haven't looked into that yet.
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.
Please do look into it, but I think that's something we can live with if not fixable currently with the other needed libraries.
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 ran a fresh install and didn't encounter any Depreciation errors this time. I updated the list of packaged in metadata.json to reflect what was installed, including now using monai 1.5.
@ericspod Will the requirements be installed automatically when the bundle is downloaded? From the user end, how does that work? From my end, how do I simulate the install?
"inputs": { | ||
"image": { | ||
"type": "image", | ||
"format": "PNG", |
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.
"Format" is meant to be about what the pixel values are, eg. just magnitude values or Hounsfield units.
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.
This format
value should be "magnitude" to indicate the values represent differing light or energy levels without units.
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.
Fixed.
…hon 3.10. Modified metadata.json, README.md, and ./docs/requirements.txt files accordingly.
Hi @ybagdasa @yiheng-wang-nv this is definitely making progress. If we have a working build for Python 3.10 we can look into removing the Miniconda use in the CICD system and simplify the implementation. Other than that the code is well commented and a few remaining issues can be addressed easily I think. |
Fixes # .
Description
This is a proposed segmentation model to add to the model zoo.
Status
Ready for review/work in progress.
Please ensure all the checkboxes:
./runtests.sh --codeformat
.version
andchangelog
inmetadata.json
if changing an existing bundle.CONTRIBUTING.md
).monai
,pytorch
andnumpy
are correct inmetadata.json
.eval_metrics
of the provided weights and TorchScript modules.large_file.yml
./home/your_name/
for"bundle_root"
).