This repository contains a machine learning pipeline for localizing Ground Control Point (GCP) markers in high-resolution aerial images and classifying their shape (Cross, Square, L-Shaped).
The goal is to analyze aerial images containing GCP markers, predict the exact (x, y) pixel coordinates of the center of these markers, and classify their shape into one of three predefined classes.
- Multi-task Learning: A unified model based on
ResNet-34that simultaneously predicts the keypoint coordinates (localization) and robustly classifies the token shape (classification) using two separate decision heads. - Efficient Handling of Large Imagery: Raw images (2048x1365) are automatically resized maintaining their keypoints coordinates scaling properties.
- Lightweight Inference: Produces predictions seamlessly for missing markers.
dataset.py: Contains a PyTorchDatasetdefinition for parsinggcp_marks.jsonannotations and scaling coordinates dynamically.model.py: Implements theGCPModelclass, utilizing a pre-trained ResNet-34 backbone with separate heads for spatial layout and classification output.train.py: The main loop orchestrating data-loading, validation splits, PCK metrics computation, loss summation (Smooth L1 Loss + CrossEntropy), & saving best model weights (best_gcp_model.pth).inference.py: Evaluation pipeline strictly generating the structuredpredictions.json.eda.py: Preliminary logic verifying bounding boxes distribution across categories & scanning corrupted samples.
Ensure you have a complete Python 3.9+ setup.
# Install required libraries
pip install torch torchvision numpy pandas matplotlib scikit-learn tqdm PILMake sure the labeled dataset exists at data/GCP_Assignment_Datasets/train_dataset/. Then initialize the training block:
python train.pyEnsure the unlabelled datasets exists at data/GCP_Assignment_Datasets/test_dataset/ and the trained weights best_gcp_model.pth sits within the directory. Start the validation mapping:
python inference.pyThe predictions structure is fully available in predictions.json generated in the current workspace loop.