This repository contains two Python scripts for object localization tasks. The first script (manual_annotation.py
) facilitates the manual annotation of bounding boxes around cat noses in images. The second script (cnn_training.py
) is designed to load the annotated dataset, preprocess images, and train a Convolutional Neural Network (CNN) for object localization.
The purpose of this script is to allow users to manually annotate images by drawing bounding boxes around cat noses. The annotated bounding box coordinates are then saved to a CSV file for further use in training a machine learning model.
-
Requirements:
- Python (>=3.6)
- OpenCV
- Pandas
-
Setup:
- Set the
image_folder_path
variable to the path containing cat images. - Set the
output_csv_path
variable to the desired output CSV file path.
- Set the
-
Annotation Process:
- Run the script.
- Click on the cat nose and drag to draw a bounding box.
- Press "c" to save the annotation and move on to the next image.
-
Output:
- The script outputs a CSV file containing image filenames and corresponding bounding box coordinates.
This script is designed to load the annotated dataset generated using the manual annotation script, preprocess the images, and train a CNN for object localization. The CNN is trained to predict the bounding box coordinates (xmin, ymin, xmax, ymax) for cat noses in images.
-
Requirements:
- Python (>=3.6)
- OpenCV
- Numpy
- Pandas
- Scikit-learn
- TensorFlow (>=2.0)
-
Setup:
- Set the
annotations_csv_path
variable to the path of the CSV file generated by the manual annotation script.
- Set the
-
Training Process:
- Run the script.
- The script loads images, preprocesses them, splits the dataset, defines a CNN model, and trains the model.
- The model is trained to minimize the mean squared error between predicted and actual bounding box coordinates.
-
Output:
- The trained model can be used for object localization tasks.
- Adjust paths and parameters in the scripts based on your specific folder structures and requirements.
- Ensure all required dependencies are installed before running the scripts.