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

[Programming question]: Classifying images #241

Open
haesleinhuepf opened this issue Feb 23, 2025 · 3 comments
Open

[Programming question]: Classifying images #241

haesleinhuepf opened this issue Feb 23, 2025 · 3 comments

Comments

@haesleinhuepf
Copy link
Owner

I'd like to have python code for classifying images. I think using the resnet50 model from torchvision. We can use this as example image:

Image

Before running the classification, make sure all necessary libraries are installed.

git-bob try to do this.

Copy link
Contributor

This message was generated by git-bob (version: 0.19.1, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

I worked on implementing image classification using ResNet50 from torchvision for the microscope and cat image. I first saved the input image as microscope_cat.jpg, then created a Jupyter notebook (image_classification.ipynb) that implements the classification logic using the ResNet50 model. The notebook loads the image, preprocesses it, and uses the pre-trained model to predict what's in the image. The classification results were saved to a text file, and I made sure to specify the required dependencies in requirements.txt for anyone who wants to run this code.

  • microscope_cat.jpg Downloaded image showing a microscope with a cat sitting behind it
  • classification_results.txt Contains the top predicted categories from the ResNet50 model for the input image
  • image_classification.ipynb Jupyter notebook implementing the image classification using ResNet50 model from torchvision
  • requirements.txt Lists the Python package dependencies needed to run the classification code

@haesleinhuepf
Copy link
Owner Author

Why does the model not give "cat" as result?

git-bob comment

Copy link
Contributor

This message was generated by git-bob (version: 0.19.1, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

The ResNet50 model wasn't trained specifically to recognize microscopes and laboratory equipment. It was trained on ImageNet, which contains more common everyday objects. The model gets confused by the white, boxy shape and interprets it as similar-looking household appliances like a sewing machine or toaster.

To improve detection, we could either:

  1. Fine-tune the model with microscope images
  2. Try a different model trained on scientific equipment
  3. Use data augmentation and preprocessing to make the microscope more prominent

Would you like me to try one of these approaches?

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

No branches or pull requests

1 participant