💻 Image Recognition: Nuts and Screws
This repository presents a project focused on image recognition of nuts and screws using object detection techniques. The objective is to develop a model capable of accurately detecting and classifying nuts and screws in images, enabling automation and quality control in industrial settings.
The project consists of the following stages:
- 💻 Import Dependencies: Installation of necessary dependencies, including OpenCV, UUID, and others.
- 💻 Define Images to Collect: Setting the labels (nuts and screws) and the number of images to collect for each label.
- 💻 Setup Folders: Creating the necessary folder structure for storing collected images.
- 💻 Capture Images: Utilizing the webcam to capture a specified number of images for each label.
- 💻 Image Labelling: Using the LabelImg tool to annotate and label the collected images.
- 💻 Move them into a Training and Testing Partition: Organizing the labelled images into separate training and testing sets.
- 💻 Compress them for Colab Training (Optional): Compressing the image data for training on Colab.
The project leverages the following technologies:
- Python
- OpenCV
- LabelImg
These technologies are used for image capture, labelling, and dataset preparation.
To run the project locally, follow these steps:
- Install the necessary dependencies by running
pip install -r requirements.txt
. - Run the Jupyter notebook file to capture images, perform labelling, and prepare the dataset.
The project has the following file structure:
├── images
│ ├── collectedimages
│ │ ├── screw
│ │ └── nut
│ ├── train
│ └── test
├── Tensorflow
│ ├── labelimg
│ │ ├── labelImg.py
│ │ ├── libs
│ │ └── resources.qrc
│ └── workspace
│ ├── annotations
│ ├── images
│ └── models
├── generate_tfrecord.py
└── README.md
images/collectedimages
: Folder for storing the collected images of nuts and screws.images/train
: Folder for training images.images/test
: Folder for testing images.Tensorflow/labelimg
: Directory containing the LabelImg tool for image labelling.Tensorflow/workspace
: Workspace directory for TensorFlow object detection.generate_tfrecord.py
: Python script to generate TFRecord files for training and testing.
The trained model can be evaluated by running the provided Jupyter notebook, which includes the image recognition code. The notebook loads the trained model, processes the test images, and displays the detection results.
Special thanks to the TFODCourse repository by Nicknochnack, which provided valuable guidance and resources for this project, they had a heavy impact on the project. You can watch a helpful YouTube video from the repository here.
This project is licensed under the MIT License. You are free to use, modify, and distribute the code for educational or commercial purposes.
For any questions or inquiries, please contact at jair2000.0224@hotmail.com.