# 1. Clone the repository
git clone [email protected]:shashankyld/superpoint_pytorch.git
cd superpoint_pytorch
# 2. Sync the environment (Creates .venv and installs all dependencies from uv.lock)
uv sync
# 3. Verify the installation
uv run python -c "import torch; print(f'CUDA Available: {torch.cuda.is_available()}')"
# Check for errors
uv run ruff check .
# Formats the codebase
uv run ruff format .
(tested on)
1. python == 3.13
2. pytorch == 2.1.1
3. torchvision == 0.16.1
# 1. I just have notebooks folder to verify all the classes that I create of the model, dataset, evaluation metrics.
Step 1: Train Magic Point on Synthetic Dataset
One thing that I think I will avoid is to set keypoints at intersections that exist in 2D because of overlapping shapes but really they are not stable points to track. Imagine as the camera moves, the intersection keeps changing in the 2D space in the case shown below:
Sometimes, geometric augmentations can create artificial corners when the regions outside the boundary enter the image frame after the transformation as shown below. Look at the perspective and affine sections where ellipse now has two more corners that are missed out in the ground truth keypoints.
I want to have perfect ground truth keypoints and hence, I will add cropping after geometric augmentations to avoid such cases. This ensures diversity that comes from perspective distortions without post-processing issues for new keypoint search.
I for now just implemented cropping after geometric augmentations just to avoid the above issue. In future, I can think of more robust ways to handle this.
uv run train_magicpoint.py
1. 10e-4 learning rate with 100:1 weighted cross entropy loss did not converge well. Loss was around 2 after X epochs.
2. 10e-5 learning rate with 10:1 weighted cross entropy loss converged well. Loss was around 0.7 after Y epochs.
3. 10e-6 learning rate with 1:1 weighted cross entropy loss converged well. Loss was around 0.1 after Z epochs.
Direct Results of Magic Point on Real Images without any Fine-tuning - Even Without Homographic Adaptation.
Download coco5K val set from:
# 1. Create the directories
mkdir -p data/coco
# 2. Download (using -c to allow resuming if connection drops)
wget -c http://images.cocodataset.org/zips/val2017.zip -P data/coco/
# 3. Extract and Cleanup
# This will extract into data/coco/val2017/
unzip data/coco/val2017.zip -d data/coco/
rm data/coco/val2017.zip











