Welcome to your go-to guide for implementing DMPR-PS, a novel approach for parking-slot detection using directional marking-point regression, using PyTorch. Whether you’re diving into the world of AI or just brushing up on your skills, this article will walk you through the key steps in a user-friendly manner.
Requirements
Before we start the implementation, make sure you have the following:
- PyTorch
- CUDA (optional but recommended for performance)
- Other required packages (install using the command below)
pip install -r requirements.txt
Preparing Pre-trained Weights
To replicate the numbers in the DMPR-PS paper, you’ll need pre-trained weights. You can download them from the following link:
Inference Process
Inference involves two modes: image and video. Feel free to use either depending on your needs.
- Image Inference: To perform image inference, run the command below:
python inference.py --mode image --detector_weights $DETECTOR_WEIGHTS --inference_slot
python inference.py --mode video --detector_weights $DETECTOR_WEIGHTS --video $VIDEO --inference_slot
Note: The DETECTOR_WEIGHTS argument refers to the trained weights of the detector, while VIDEO is the path to the selected video.
Data Preparation
To prepare your data, follow these steps:
- Download the PS2.0 from here, and extract the files.
- Download the labels and extract them. If you wish to label your own data, use the directional_point branch of MarkToolForParkingLotPoint.
- Perform data preparation and augmentation using the commands below:
python prepare_dataset.py --dataset trainval --label_directory $LABEL_DIRECTORY --image_directory $IMAGE_DIRECTORY --output_directory $OUTPUT_DIRECTORY
python prepare_dataset.py --dataset test --label_directory $LABEL_DIRECTORY --image_directory $IMAGE_DIRECTORY --output_directory $OUTPUT_DIRECTORY
Make sure to replace the necessary arguments with your directory paths.
Training the Model
Once your data is prepared, it’s time to train the model. Simply run:
python train.py --dataset_directory $TRAIN_DIRECTORY
The TRAIN_DIRECTORY is the directory generated from data preparation. You can also explore config.py for details on batch size, learning rate, and other settings.
Evaluating the Model
To evaluate your model for both directional marking-point detection and parking-slot detection, use the following commands:
- Directional Marking-Point Detection:
python evaluate.py --dataset_directory $TEST_DIRECTORY --detector_weights $DETECTOR_WEIGHTS
python ps_evaluate.py --label_directory $LABEL_DIRECTORY --image_directory $IMAGE_DIRECTORY --detector_weights $DETECTOR_WEIGHTS
Troubleshooting
If you run into issues during implementation, here are some troubleshooting ideas:
- Make sure you have installed all requirements correctly without errors.
- Verify that the paths for your directories are correct.
- Check if you’ve set up the correct versions of PyTorch and CUDA.
- For any additional inquiries, feel free to reach out to the community or explore resources at fxis.ai.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Conclusion
You now have a complete guide to implementing DMPR-PS using PyTorch. Take each step at your own pace, and soon you’ll find yourself mastering parking-slot detection like a pro!

