This project focuses on detecting rocks and shadows from lunar terrain images using the POLAR SIM dataset. Two object detection models were explored:
- YOLOv5 Nano
- Faster R-CNN (with MobileNet backbone)
-
Clone the POLAR-Sim repository:
git clone https://github.com/uwsbel/POLAR-Sim.git
This repository contains YOLO-compatible labels.
-
Download the POLAR SIM dataset and extract it.
-
Clone this project repository:
git clone https://github.com/Sohm14/object_detection.git
-
Clone YOLOv5 Repository:
- Clone the YOLOv5 repository and install dependencies:
git clone https://github.com/ultralytics/yolov5 cd yolov5 pip install -r requirements.txt
- Clone the YOLOv5 repository and install dependencies:
-
Download YOLOv5 Nano Model:
- Use
wgetto download the YOLOv5 Nano model:wget https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5n.pt
- Use
-
Prepare the Dataset:
- Run the scripts in the dataset_preparation directory in the following order:
data_preparation.pyimage_resize.pyimage_to_rgb.pyaugmentation.py
- Run the scripts in the dataset_preparation directory in the following order:
-
Create the Configuration File:
- Create a
custom_dataset.yamlfile as shown in theyolo_traindirectory. This file should define the paths to the dataset and the number of classes.
- Create a
-
Train the Model:
- Run the YOLOv5 training script:
python yolo5_model_train.py
- The trained model will be saved in the
modelsdirectory.
- Run the YOLOv5 training script:
-
View Predictions:
- Run the
result.pyscript to see predictions on test images.
- Run the
-
Convert Labels:
- Run the
convert_yolo_labels.pyscript to convert YOLO labels to Faster R-CNN format. - The converted dataset will be saved in the
datasetsdirectory within thercnn_traindirectory.
- Run the
-
Train the Model:
- See the training script in the jupitar notebook for Faster R-CNN (with MobileNet backbone):
sol.ipynb
- See the training script in the jupitar notebook for Faster R-CNN (with MobileNet backbone):
-
Evaluate the Model:
- Use the confusion matrix to evaluate the model performance .
- using confusion_matrix.ipynb
Both models were trained and tested on the POLAR SIM dataset. The performance of the models was evaluated based on accuracy and the ability to detect both rocks and shadows under varying lunar terrain conditions.
- Python 3.8+
- PyTorch
- OpenCV
- NumPy
- YOLOv5 dependencies
- Faster R-CNN dependencies
Install the required Python packages:
pip install -r requirements.txt