You can also run real-time demo using your webcam by specifying the camera's device ID with option `--cam`.
```Shell
python demo.py -c=configs/m2det512_vgg.py -m=weights/m2det512_vgg.pth --show --cam=0
```
**In addition, I really suggest you to change the nms type from soft-nms to hard-nms for faster visualization. Soft-NMS is good for mAP accuracy, but it's useless for Demo/Vis.**
Thanks for the volunteer demonstration of m2det: [entry1](https://www.youtube.com/watch?v=VF8JuQwKQmU), [entry2](https://www.youtube.com/watch?v=1hugYRnLTHM), [entry3](https://www.youtube.com/watch?v=sYkqcTImK9w).
## Evaluation
1, **We provide evaluation script for M2Det:**
```Shell
python test.py -c=configs/m2det512_vgg.py -m=weights/m2det512_vgg.pth
```
Then, the evaluated result is shown as:
Even higher than our paper's original result! :)
**2, You can run the test set with M2Det and submit to get a score:**
```Shell
python test.py -c=configs/m2det512_vgg.py -m=weights/m2det512_vgg.pth --test
```
and submit the result file to [CODALAB webpage](https://competitions.codalab.org/competitions/5181#participate).
## Training
As simple as [demo](#Demo) and [evaluation](#Evaluation), Just use the train script:
```Shell
CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py -c=configs/m2det512_vgg.py --ngpu 4 -t True
```
All training configs and model configs are written well in configs/*.py.
## Multi-scale Evaluation
To be added.
## Pre-trained Files
Now, we only provide m2det512_vgg.pth([baidu cloud](https://pan.baidu.com/s/1LDkpsQfpaGq_LECQItxRFQ),[google drive](https://drive.google.com/file/d/1NM1UDdZnwHwiNDxhcP-nndaWj24m-90L/view?usp=sharing)) due to we have other tasks recently, we decide to release other models in the future.
## Others
### Citation:
Please cite the following paper if you feel M2Det useful to your research
```
@inproceedings{M2Det2019aaai,
author = {Qijie Zhao and
Tao Sheng and
Yongtao Wang and
Zhi Tang and
Ying Chen and
Ling Cai and
Haibing Lin},
title = {M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network},
booktitle = {The Thirty-Third AAAI Conference on Artificial Intelligence,AAAI},
year = {2019},
}
```
## Contact
For any question, please file an issue or contact
```
Qijie Zhao: zhaoqijie@pku.edu.cn
```