Skip to content
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

[Getting Familiar][Refactor] list out hardcodings in the preprocessors #85

Open
Udayraj123 opened this issue Oct 7, 2022 · 17 comments
Open

Comments

@Udayraj123
Copy link
Owner

Describe the bug
There are some hardcodings in the codebase(some of which are tagged by a todo comment). We need to remove them and pick them up from configuration/command line. The first step would be to list out the hardcoded values in a comment below.
Then we'll break it down into new issues to fix them in parts.

To Reproduce
One example is from src/processors/CropPage.py : the parameters passed to cv2.Canny can be taken from something like self.canny_params

image

Acceptance Criteria
A list of all hardcodings should be populated.

Screenshots
NA

Desktop (please complete the following information):

  • OS: any
  • Python version: 3.10.6
  • OpenCV version: 4.6.0

Additional context
NA

@tuxo
Copy link

tuxo commented Oct 7, 2022

can i be assigned to this one? ☺️

@Udayraj123
Copy link
Owner Author

@tuxo any updates?

@GeorgiaMayDay
Copy link

Since @tuxo hasn't updated this issue in over a month, I thought I'd try it

@GeorgiaMayDay
Copy link

Line 336 in core.py
Score should be automatically evaluated but it currently hardcoded as a constant
image

After line 25 in CropOnMarkers
Hardcode: relativePath: “Omr_marker.jpg” are both set up in the template json samples – could this not be gotten from there?
image

From line 81 in CropPages
Hardcode: This could be passed in from the template configuration
image

Line 120 in imgutils.py
Hardcode: All the variables here are hard coded when it feels like these would be better as defaults that the user could change in config
image

Line 627 in imagutil.py
Hardcode: both x and y are hard coded when they should either be constants or configurable

image

Line 658 in imagutil.py
Hardcode: similar to the above, x and y have been hardcode.

image

Line 914 and 915 in imagutil.py
Hardcode: these should be constants or configurable

image

Other:

This is line is repeated in FeatureBasedAlignment, CropPages and imgutils– perhaps worth putting into a separate file and importing around to keep the code DRY?
image

From 125 in core.py
There is some unreachable logger code due to the return True.
Suggestion: Either the early return True is deleted or the logger code
image

@GeorgiaMayDay
Copy link

I noticed some other minor issues apart from hardcoding I highlighted under other

@Udayraj123
Copy link
Owner Author

Hi @GeorgiaMayDay, sorry I missed above comment. Will check soon. I hope you've joined over discord as well(I tend to respond quicker there)

@pranavajith
Copy link

I'm up for this challange, @Udayraj123 ..
Although some resources as to how to set hardcodings in preprocessors would be amazing.

@Udayraj123
Copy link
Owner Author

@pranavajith please check discord for my reply.

@Udayraj123 Udayraj123 added help wanted Extra attention is needed and removed codepeak labels Jan 4, 2023
@Udayraj123
Copy link
Owner Author

Code is updated with some of the hardcodings reduced. New contributors can help here by checking for more hardcodings in the fresh code.

@esing1201
Copy link

Hi @Udayraj123 I am happy to help. I will appreciate some resources if possible.

@Udayraj123
Copy link
Owner Author

Hi @esing1201, good to know! You can setup the repo if you haven't and discuss if you face any issues.
This issue is about finding all hardcoded numbers in the repo and moving them into constants or config options, etc.

Please join over discord to get quicker replies :)

@rakeshcj
Copy link

HI @Udayraj123 is the issue still open ?

@Udayraj123
Copy link
Owner Author

Hi @rakeshcj, yes the issue is still open. Most of the hardcodings are in pre-processors that still need attention. Do let me know if you're picking it up!

@rakeshcj
Copy link

rakeshcj commented Jan 28, 2024 via email

@Udayraj123
Copy link
Owner Author

Hi @rakeshcj let me know if any blockers.

@Darpana-iitgn
Copy link

Darpana-iitgn commented Oct 5, 2024

Hi @Udayraj123, I am a beginner to open source, can you assign this issue to me so that I can try working on it? I would appreciate any help/resources if possible

@Udayraj123
Copy link
Owner Author

Hey @Darpana-iitgn, sure!
This task is now relevant for the v2 code since it contains a lot of refactoring (yet has hardcodings at places)
Please go through the dev branch code and try to find the hardcoded items. Based on each item you share I can provide a way to make it generic to be consumable from on of the schemas (template_schema.py etc).

@Darpana-iitgn Darpana-iitgn removed their assignment Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

7 participants