Downloads · 30 days
18
100% of all-time downloads
Crystalbullet/lunar_project
lunar_project is a image classification model from Crystalbullet. Use it when you need a label for an image. It is set up for pytorch.
Binary image classification of lunar terrain: 0 = Depth, 1 = Rise. Each observation contains a 256×256 grayscale image and its acquisition sunazimuthangle.
Downloads · 30 days
18
100% of all-time downloads
All-time downloads
18
Public
Repo size
136 MB
Likes
2
Public
Click a slice to open those files.
.pt135 MB · 99%
From the Hugging Face model README
Binary image classification of lunar terrain: 0 = Depth, 1 = Rise. Each observation contains a 256×256 grayscale image and its acquisition sun_azimuth_angle.
| Metric | Result |
|---|---|
| Final trained model | ResNet18 raw_fusion — image + sun-azimuth fusion |
| Task | Lunar Terrain Classification |
| Development performance | 76.67% mean balanced accuracy across five grouped folds |
| Untouched holdout performance | 76.40% balanced accuracy on 1,122 observations |
| Final training data | 7,852 eligible labeled observations |
| Local final checkpoint | inference.pt |
| Submitted CSV | submission.csv |
The final model uses the unrotated image together with the original sun angle. The frozen decision threshold is 0.48025015. The holdout score is balanced accuracy, not ordinary accuracy. The simple fixed-angle baseline scored 78.29% on the same holdout, so the neural model should not be described as superior to that baseline.
sun_azimuth_angle encoded as [sin(θ), cos(θ)], then processed by an MLP 2 → 32 → 16.528 → 128 → 1 classifier for binary prediction.raw_fusion: image pixels are not rotated, and the original acquisition angle is supplied to the metadata branch.Canonical rotation was tested as a controlled alternative. Images were rotated about their center with OpenCV using both -sun_azimuth_angle and the opposite sign. The canonicalized variants used a 256×256 canvas and neutral-gray padding for exposed borders. The original acquisition angle remained available as metadata.
The dataset’s physical angle convention is undocumented, so rotation was not assumed to be correct. Five-fold results selected unrotated fusion: raw_fusion achieved 76.67% mean balanced accuracy versus 76.09% for canonicalized fusion. Therefore, the final model does not rotate pixels; it uses the image plus sine/cosine angle encoding.
BCEWithLogitsLoss, with class weighting computed from each training partition.3e-5 for the ResNet backbone and 3e-4 for the fusion/classifier head.1e-4; classifier dropout: 0.3.32; CUDA AMP enabled; two persistent data-loader workers.The local audited final checkpoint is runs/phasewise_v3/models/final_refit/inference.pt. The legacy runs/resnet18_fusion/best_model.pt belongs to the earlier experiment and is not the final phasewise_v3 production checkpoint.
The model artifact is available on Hugging Face for convenient access and independent evaluation:
Hugging Face: Crystalbullet/lunar_project
Relevant hosted model file: best_model.pt.
submission.csv.IMPLEMENTATION_REPORT.mdThe project investigates whether lunar terrain appearance can be classified reliably when illumination direction is provided as metadata. It compares image-only, canonicalized-image, angle-only, fixed-angle-rule, and image-plus-angle models using grouped evaluation and a sealed holdout.
Train_DATA/ Training images and metadata
Test_DATA/ Evaluation images and metadata
dataset.py Image loading, normalization, augmentation, angle encoding
model.py ResNet18 image/metadata fusion model
training_engine.py GPU trainer, checkpointing, early stopping, evaluation
pipeline.py Audited benchmark, comparison, tuning, holdout, and refit pipeline
predict.py Checkpoint-based inference and CSV validation
test_pipeline.py Contract and GPU resume tests
runs/phasewise_v3/ Final experiment artifacts and reports
submission.csv Validated 2,000-row prediction file
The verified environment uses Python 3.12, PyTorch 2.11.0+cu128, torchvision 0.26.0+cu128, and an NVIDIA GPU. The project requires CUDA for production training and inference.
.venv\Scripts\python.exe -m unittest test_pipeline
.venv\Scripts\python.exe -u pipeline.py --stage all
For a fresh environment, install the CUDA PyTorch wheel pair from the official CUDA 12.8 index before installing requirements.txt. Use only opencv-python-headless, not multiple OpenCV packages providing the same cv2 namespace.
.venv\Scripts\python.exe predict.py `
--checkpoint runs/phasewise_v3/models/final_refit/inference.pt `
--output new_submission.csv
Inference validates the exact columns image_id,label, evaluation-row order, IDs, null handling, and binary integer labels. Probabilities are written beside the requested output as evaluation_probabilities.csv.
Run the complete restartable workflow:
.venv\Scripts\python.exe -u pipeline.py --stage all
Or run one explicit fold in chunks:
.venv\Scripts\python.exe train.py `
--run-id example_f0 `
--variant raw_fusion `
--fold 0 `
--total-epochs 8 `
--chunk-epochs 5
Checkpoints contain model, optimizer, scheduler, AMP scaler, RNG state, configuration, data fingerprints, and training history. A resumed run must use a compatible checkpoint and configuration.
| Evaluation | Balanced accuracy |
|---|---|
| Five-fold development mean — raw fusion | 76.67% |
| Five-fold development mean — canonicalized fusion | 76.09% |
| Untouched holdout — selected neural model | 76.40% |
| Untouched holdout — fixed-angle rule | 78.29% |
| 270°–315° illumination-shift diagnostic | 50.00% |
The 50.00% shift diagnostic indicates weak generalization to that held-out lighting range. The holdout was evaluated before the all-data refit; the refitted checkpoint has no independent labeled test evaluation afterward.
sun_azimuth_angle.No license file is currently included. The model and experiment artifacts are provided for evaluation and hackathon use; add a project-specific license before redistribution.