This repo implements SSD (Single Shot MultiBox Detector). The implementation is heavily influenced by the projects ssd.pytorch and Detectron. The design goal is modularity and extensibility.
It has MobileNetV2 SSD/SSD-Lite implementations.
It also has out-of-box support for retraining on Google Open Images dataset.
- Python 3.6+ (3.6.13)
- OpenCV
- Pytorch 1.0 or Pytorch 0.4+
- Pandas
Setup a virtual environment for the installation. Here, Anaconda is used. Run the following commands to install th required dependencies.
conda create -y -n <env-name> python=3.6.13
pip install -r requirements.txt
To run the application, execute the following command. In case a camera is not used for input, a video file's path can be passed as an argument in the command.
python main.py <optional-video-filepath>
Setup your credentials such as email id and mobile number to receive alerts on threat detection.
MobileNetV2 SSD/SSD-Lite is slower than MobileNetV1 SSD/Lite on PC. However, MobileNetV2 is faster on mobile devices.
Average Precision Across All Classes:0.6860690100560214
python open_images_downloader.py --root ~/data/open_images --class_names "Handgun,Shotgun" --num_workers 20
It will download data into the folder ~/data/open_images.
The content of the data directory looks as follows.
class-descriptions-boxable.csv test validation
sub-test-annotations-bbox.csv test-annotations-bbox.csv validation-annotations-bbox.csv
sub-train-annotations-bbox.csv train
sub-validation-annotations-bbox.csv train-annotations-bbox.csv
The folders train, test, validation contain the images. The files like sub-train-annotations-bbox.csv is the annotation file.