This project provides an end-to-end pipeline for detecting craters on lunar surface images and videos using a YOLOv8 deep learning model. It also identifies the safest landing zones by analyzing crater density.
- Modular, easy-to-understand codebase
- Video and image inference
- Safe landing zone detection
- Ready for research and deployment
- Crater detection using YOLOv8
- Video and image processing
- Automatic safe landing zone suggestion
- Modular, well-documented code
- CLI for easy usage
- Visualization and result saving
Crater-Detection-on-Lunar-Surface/
│
├── src/
│ ├── __init__.py
│ ├── config.py
│ ├── model.py
│ ├── detection.py
│ ├── video_utils.py
│ ├── image_utils.py
│ ├── visualization.py
│
├── main.py
├── requirements.txt
├── weights/
│ ├── best.pt
│ ├── last.pt
│ └── args.yaml
├── report/
│ └── Report_A1/
│ ├── val_batch0_pred.jpg
│ ├── val_batch1_pred.jpg
│ ├── val_batch2_pred.jpg
│ └── ...
├── result/
│ └── model_A1/
│ ├── predicted_image.jpg
│ └── video_craters.csv
├── testing/
│ ├── images/
│ │ └── image.png
│ └── videos/
│ └── video.mp4
├── README.md
└── ...
- Clone the repository:
git clone https://github.com/yourusername/Crater-Detection-on-Lunar-Surface.git cd Crater-Detection-on-Lunar-Surface
- Install dependencies:
pip install -r requirements.txt
- Download model weights:
- Place your YOLOv8 weights in
weights/best.pt
.
- Place your YOLOv8 weights in
python main.py --input_video path/to/video.mp4 --output_video path/to/output.mp4
python main.py --input_image path/to/image.png --output_image path/to/output.jpg
--input_video
: Path to input video--output_video
: Path to save annotated video--input_image
: Path to input image--output_image
: Path to save annotated image--conf
: Confidence threshold (default: 0.5)--window_size
: Safe zone window size (default: 100 100)--stride
: Sliding window stride (default: 20)--weights
: Path to YOLO model weights (default: weights/best.pt)--max_craters
: Maximum number of craters allowed in a safe landing window (default: 0)
To display images or videos in the README:
- Move/copy your desired output images (e.g.,
result/model_A1/predicted_image.jpg
or any fromreport/Report_A1/
) to animages/
folder at the root, and reference as:- For videos, move/copy to a
videos/
folder at the root, and reference as:- Alternatively, upload to an image/video hosting service and use the direct URL.
- src/config.py: Configuration and argument parsing
- src/model.py: Model loading and inference
- src/detection.py: Crater detection logic
- src/video_utils.py: Video reading/writing utilities
- src/image_utils.py: Image reading/writing utilities
- src/visualization.py: Drawing and visualization helpers
- main.py: Entry point, CLI, and workflow orchestration
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.