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

Feature extraction for a single image #155

Open
dillon-quan opened this issue Oct 17, 2023 · 7 comments
Open

Feature extraction for a single image #155

dillon-quan opened this issue Oct 17, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@dillon-quan
Copy link

Hello,

I noticed that the package only works when extracting features for a directory of images but not for a single image. The error message that I get is shown down below. I was wondering if anyone can provide any suggestions on how to workaround this issue if I want to be able to generate feature extraction for a single image file. Thank you in advance!

...Creating dataset.
Traceback (most recent call last):
  File "/Users/dillonquan/Documents/heretic/feature_extraction.py", line 32, in <module>
    dataset = ImageDataset(
  File "<string>", line 9, in __init__
  File "/Users/dillonquan/anaconda3/envs/price/lib/python3.9/site-packages/thingsvision/utils/data/dataset.py", line 56, in __post_init__
    self._find_classes()
  File "/Users/dillonquan/anaconda3/envs/price/lib/python3.9/site-packages/thingsvision/utils/data/dataset.py", line 83, in _find_classes
    children = sorted([d.name for d in os.scandir(self.root) if d.is_dir()])
NotADirectoryError: [Errno 20] Not a directory: '/Users/dillonquan/Desktop/image_01.png'
@dillon-quan
Copy link
Author

Closing the issue since I was able to make edits to the source code to allow for feature extraction on a single image.

@dillon-quan
Copy link
Author

Reopening the issue here as a suggestion, I made edits to the source code on my local machine to allow feature extraction on a single image. The use case for this would be for performing image feature extraction in real time for model inference down stream. I am happy to contribute and add this to the package if I can get guidance on how to start or if thats something worth adding.

@dillon-quan dillon-quan reopened this Oct 18, 2023
@LukasMut
Copy link
Collaborator

Reopening the issue here as a suggestion, I made edits to the source code on my local machine to allow feature extraction on a single image. The use case for this would be for performing image feature extraction in real time for model inference down stream. I am happy to contribute and add this to the package if I can get guidance on how to start or if thats something worth adding.

Hi Dilon! Thanks for your suggestion. That may indeed be a useful addition. Feel free to open a PR and see whether all tests are passing. Ideally, you'd add a unittest for that addition to the thingsvision tests. Please see the README and tests for how to do a PR and modify/add tests. I guess, the easiest would be to fork the repo. Cheers Lukas

@LukasMut
Copy link
Collaborator

LukasMut commented Nov 7, 2023

@dillon-quan will you add a PR anytime soon?

@dillon-quan
Copy link
Author

@LukasMut Thanks for the reminder. This has slipped my mind as my schedule has been busy. I dont think it will come anytime soon due to bandwidth. Im still hopeful that I can add this feature in.

@LukasMut LukasMut added the enhancement New feature or request label Nov 8, 2023
@LukasMut
Copy link
Collaborator

@dillon-quan would you be able to finally submit that PR?

@Tankiit
Copy link

Tankiit commented Apr 17, 2024

I did a dirty hack i.e squeezed to make sure it's a 4D tensor and it works. So anyone interested could potentially try this too.

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

No branches or pull requests

3 participants