2.6 KiB
DMPR-PS
This is the implementation of DMPR-PS using PyTorch.
Requirements
- CUDA
- PyTorch
- OpenCV
- NumPy
- Pillow
- Visdom (optional)
- Matplotlib (optional)
Pre-trained weights
The pre-trained weights could be used to reproduce the number in the paper.
Inference
-
Image inference
python inference.py --mode image --detector_weights $DETECTOR_WEIGHTS -
Video inference
python inference.py --mode video --detector_weights $DETECTOR_WEIGHTS --video $VIDEODETECTOR_WEIGHTSis the trained weights of detector.
VIDEOis path to the video.
Viewconfig.pyfor more argument details.
Prepare data
-
Download ps2.0 from here, and extract.
-
Download the labels, and extract.
-
Perform data preparation and augmentation:
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_DIRECTORYLABEL_DIRECTORYis the directory containing json labels.
IMAGE_DIRECTORYis the directory containing jpg images.
OUTPUT_DIRECTORYis the directory where output images and labels are.
Viewprepare_dataset.pyfor more argument details.
Train
python train.py --dataset_directory $TRAIN_DIRECTORY
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
python evaluate.py --dataset_directory $TEST_DIRECTORY --detector_weights $DETECTOR_WEIGHTSTEST_DIRECTORYis the test directory generated in data preparation.
DETECTOR_WEIGHTSis the trained weights of detector.
Viewconfig.pyfor more argument details (batch size, learning rate, etc). -
Evaluate parking-slot detection
python ps_evaluate.py --label_directory $LABEL_DIRECTORY --image_directory $IMAGE_DIRECTORY --detector_weights $DETECTOR_WEIGHTSLABEL_DIRECTORYis the directory containing testing json labels.
IMAGE_DIRECTORYis the directory containing testing jpg images.
DETECTOR_WEIGHTSis the trained weights of detector.
Viewconfig.pyfor more argument details.