-
Notifications
You must be signed in to change notification settings - Fork 56
Refactor using tqdm and pathlib #206
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: master
Are you sure you want to change the base?
Conversation
|
@CiSong10 thanks for this. Would you please realign you branch with the new python-ci adjustments I made to master? Also please see this autogenerated review: I reviewed the diff and the intent is generally good — modernizing path handling (pathlib), adding progress bars (tqdm), cleaning up string formatting and JSON/file handling. I found several places that may cause bugs or break other code; below I list the issues grouped by file with suggested fixes. General / cross-cutting
detectree2/models/evaluation.py
detectree2/models/outputs.py
detectree2/models/predict.py
detectree2/preprocessing/tiling.py
Other stylistic/robustness notes
Summary of highest-priority fixes
|
This pull request enhances the image preprocessing capabilities in detectree2/preprocessing/tiling.py by introducing an optional RGB contrast enhancement feature and fixing some inconsistencies with return values across the tiling functions.
Tutorials updated and extended and a few other fixes * rgb contrast and unsafe access fix * experimental numpy fix * fixes a lot of accumulated mypy problem * rgb contrast and unsafe access fix * experimental numpy fix * fixes a lot of accumulated mypy problem * first small adjustments * class imbalance, finetuning, & advanced tips * refactoring tutorials * unrelated small fix * removing "step X" strings * Zenodo release version update
Updated tutorial links in the README file to point to the correct index page. Issue PatBall1#210
`Path(file_roots[num[i]]` is a string of tile stem, its `.suffix` will return an empty string. Simply tile name stem + .geojson is good.
This pull request enhances the image preprocessing capabilities in detectree2/preprocessing/tiling.py by introducing an optional RGB contrast enhancement feature and fixing some inconsistencies with return values across the tiling functions.
Updated tutorial links in the README file to point to the correct index page. Issue PatBall1#210
|
Hi, I have merged up-to-date changes from master into this PR. I humanly reviewed the AI-generated reviews and there's not much to change. Conflicts resolved, etc. etc. Please check this PR for merging. Thanks. |
|
The failing job is due to a mypy type-checking error at line 224 in detectree2/models/outputs.py: error: Unsupported target for indexed assignment ("Collection[str]") [index] Line 224 is attempting an indexed assignment on a type that does not support it—likely a type annotated as Collection rather than a mutable sequence like list. The problematic code is: geofile["features"][i] = updated_feature Or, in your context, you might do something like: some_collection[index] = value Solution: "features": List[Feature] and be sure that everywhere features is created and used, you keep it as a list (not as a generic collection or other immutable sequence). If a variable is annotated as Collection[str], you cannot assign to indices (e.g., collection[0] = 'foo'). Change the variable's annotation to list[str] or List[str]: from typing import List features: List[str] = [] Go to the definition or location at line 224 and adjust the types as shown above. For more context, refer to the file at this ref: detectree2/models/outputs.py@24d614f06f4a8dff35d829bcee8b0945dcadb1bd. Summary:
After making these changes, the mypy error will be resolved. |
|
@CiSong10 please see guidance on programming style and pre-commit hooks: https://patball1.github.io/detectree2/contributing.html#programming-style Code Formatting (isort/flake8) Failures:
Once you’ve:
Your CI action should pass both dependency installation and linting checks. |
Rewrite some functions using tqdm process bar and pathlib. Make other small code improvements as well.