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

Create image_handler.py #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Burhan-Q
Copy link

Adds new ImageObj class for image handling and manipulation. Could be used to convert to different color spaces, resize, and compare similarity (using img_hash attribute) to other images. Additional image attributes can be added (file size, file date, parent directory name, ML_task [could use this to get different types of related data per task], file hash, pixel-color counts/ratios, etc.).

@Burhan-Q
Copy link
Author

There may be some clean-up/fix-up needed still, but I was able to get it working (on Windows)

@GeorgePearse
Copy link
Owner

GeorgePearse commented Sep 5, 2023

Looking through this more now and really like it (or at least, I've found myself needing the functionality without being sure how to implement it).

The biggest thing is trying to smoothly work with a bunch of model APIs where some require filepaths and some require images and knowing how to pass that object around neatly (e.g. to a classifier that runs on an image crop from an object detection model).

@Burhan-Q

@Burhan-Q
Copy link
Author

Burhan-Q commented Sep 5, 2023

@GeorgePearse that's fair. I mainly built this as a generic handler for images that had some common built in functionality that I find myself using often (and because I wanted to try programming class properties). I suspect you could use this from model to model using a getattr based on whatever the model needs. For instance, each model could be paired with a dictionary that has an input "config" then you could pass each key-value pair to your image object to return specifically what you need for that object.

Thinking about including crops (as well as box coordinates, classes, masks, etc.) makes sense too. Probably wouldn't be a bad idea to include those as class attributes as well, which could even use the same Image class to have all the same functionality available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants