DMPR-PS: A Novel Approach for Parking-Slot Detection Using Directional Marking-Point Regression
DMPR-PS
This is the implementation of DMPR-PS using PyTorch.
Requirements
- PyTorch
- CUDA (optional)
- Other requirements
pip install -r requirements.txt
Pre-trained weights
The pre-trained weights could be used to reproduce the number in the paper.
Inference
- Image inference
(shell)
python inference.py --mode image --detectorweights $DETECTORWEIGHTS --inference_slot
- Video inference
(shell)
python inference.py --mode video --detectorweights $DETECTORWEIGHTS --video $VIDEO --inference_slot
Argument DETECTOR_WEIGHTS is the trained weights of detector. Argument VIDEO is path to the video. View config.py for more argument details.
Prepare data
(In case you want to label your own data, you can usedirectional_point branch of my labeling tool MarkToolForParkingLotPoint.)
- Perform data preparation and augmentation:
(shell)
python preparedataset.py --dataset trainval --labeldirectory $LABELDIRECTORY --imagedirectory $IMAGEDIRECTORY --outputdirectory $OUTPUT_DIRECTORY
python preparedataset.py --dataset test --labeldirectory $LABELDIRECTORY --imagedirectory $IMAGEDIRECTORY --outputdirectory $OUTPUT_DIRECTORY
Argument LABEL_DIRECTORY is the directory containing json labels. Argument IMAGE_DIRECTORY is the directory containing jpg images. Argument OUTPUT_DIRECTORY is the directory where output images and labels are. View prepare_dataset.py for more argument details.
Train
(shell)
python train.py --datasetdirectory $TRAINDIRECTORY
Argument TRAIN_DIRECTORY is the train directory generated in data preparation. View config.py for more argument details (batch size, learning rate, etc).
Evaluate
- Evaluate directional marking-point detection
(shell)
python evaluate.py --datasetdirectory $TESTDIRECTORY --detectorweights $DETECTORWEIGHTS
Argument TEST_DIRECTORY is the test directory generated in data preparation. Argument DETECTOR_WEIGHTS is the trained weights of detector. View config.py for more argument details (batch size, learning rate, etc).
- Evaluate parking-slot detection
(shell)
python psevaluate.py --labeldirectory $LABELDIRECTORY --imagedirectory $IMAGEDIRECTORY --detectorweights $DETECTOR_WEIGHTS
Argument LABEL_DIRECTORY is the directory containing testing json labels. Argument IMAGE_DIRECTORY is the directory containing testing jpg images. Argument DETECTOR_WEIGHTS is the trained weights of detector. View config.py for more argument details.
Citing DMPR-PS
If you find DMPR-PS useful in your research, please consider citing:
()
@inproceedings{DMPR-PS,
Author = {Junhao Huang and Lin Zhang and Ying Shen and Huijuan Zhang and Shengjie Zhao and Yukai Yang},
Booktitle = {2019 IEEE International Conference on Multimedia and Expo (ICME)},
Title = {{DMPR-PS}: A novel approach for parking-slot detection using directional marking-point regression},
Month = {Jul.},
Year = {2019},
Pages = {212-217}
}