add model card
Browse files
README.md
CHANGED
@@ -1,3 +1,105 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
|
4 |
+
tags:
|
5 |
+
- object-detection
|
6 |
+
- computer-vision
|
7 |
+
|
8 |
+
datasets:
|
9 |
+
- coco
|
10 |
---
|
11 |
+
|
12 |
+
### Model Description
|
13 |
+
[YOLOX: Exceeding YOLO Series in 2021](https://arxiv.org/abs/2107.08430)
|
14 |
+
|
15 |
+
Improved anchor-free YOLO architecture for object detection task.
|
16 |
+
|
17 |
+
|
18 |
+
### Documents
|
19 |
+
- [GitHub Repo](https://github.com/open-mmlab/mmdetection/blob/master/configs/yolox/README.md)
|
20 |
+
- [Paper - YOLOX: Exceeding YOLO Series in 2021](https://arxiv.org/abs/2107.08430)
|
21 |
+
|
22 |
+
### Datasets
|
23 |
+
The YOLOX model was pre-trained on [ImageNet-1k](https://huggingface.co/datasets/imagenet2012) and fine-tuned on [COCO 2017 object detection](https://cocodataset.org/#download), a dataset consisting of 118k/5k annotated images for training/validation respectively.
|
24 |
+
|
25 |
+
|
26 |
+
### How to use
|
27 |
+
|
28 |
+
- Install [sahi](https://github.com/obss/sahi) and `mmdet`:
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install -U sahi
|
32 |
+
pip install mmcv-full==1.7.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html
|
33 |
+
pip install mmdet==2.26.0
|
34 |
+
```
|
35 |
+
|
36 |
+
- Load model and perform prediction:
|
37 |
+
|
38 |
+
```python
|
39 |
+
from sahi import AutoDetectionModel
|
40 |
+
from sahi.utils.file import download_from_url
|
41 |
+
from sahi.predict import get_prediction
|
42 |
+
from sahi.cv import read_image_as_pil
|
43 |
+
|
44 |
+
MMDET_YOLOX_TINY_MODEL_URL = "https://huggingface.co/fcakyon/mmdet-yolox-tiny/resolve/main/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth"
|
45 |
+
MMDET_YOLOX_TINY_MODEL_PATH = "yolox.pt"
|
46 |
+
MMDET_YOLOX_TINY_CONFIG_URL = "https://huggingface.co/fcakyon/mmdet-yolox-tiny/raw/main/yolox_tiny_8x8_300e_coco.py"
|
47 |
+
MMDET_YOLOX_TINY_CONFIG_PATH = "config.py"
|
48 |
+
IMAGE_URL = "https://user-images.githubusercontent.com/34196005/142730935-2ace3999-a47b-49bb-83e0-2bdd509f1c90.jpg"
|
49 |
+
|
50 |
+
# download weight and config
|
51 |
+
download_from_url(
|
52 |
+
MMDET_YOLOX_TINY_MODEL_URL,
|
53 |
+
MMDET_YOLOX_TINY_MODEL_PATH,
|
54 |
+
)
|
55 |
+
download_from_url(
|
56 |
+
MMDET_YOLOX_TINY_CONFIG_URL,
|
57 |
+
MMDET_YOLOX_TINY_CONFIG_PATH,
|
58 |
+
)
|
59 |
+
|
60 |
+
# create model
|
61 |
+
detection_model = AutoDetectionModel.from_pretrained(
|
62 |
+
model_type='mmdet',
|
63 |
+
model_path=MMDET_YOLOX_TINY_MODEL_PATH,
|
64 |
+
config_path=MMDET_YOLOX_TINY_CONFIG_PATH,
|
65 |
+
confidence_threshold=0.5,
|
66 |
+
device="cuda:0", # or 'cpu'
|
67 |
+
)
|
68 |
+
|
69 |
+
# prepare input image
|
70 |
+
image = read_image_as_pil(IMAGE_URL)
|
71 |
+
|
72 |
+
# perform prediction
|
73 |
+
prediction_result = get_prediction(
|
74 |
+
image=image,
|
75 |
+
detection_model=detection_model
|
76 |
+
)
|
77 |
+
|
78 |
+
# visualize predictions
|
79 |
+
prediction_result.export_predictions(export_dir='results/')
|
80 |
+
|
81 |
+
# get predictions
|
82 |
+
prediction_result.object_prediction_list
|
83 |
+
```
|
84 |
+
|
85 |
+
More info at [demo notebook](https://github.com/obss/sahi/blob/main/demo/inference_for_mmdetection.ipynb).
|
86 |
+
|
87 |
+
### BibTeX Entry and Citation Info
|
88 |
+
```
|
89 |
+
@article{akyon2022sahi,
|
90 |
+
title={Slicing Aided Hyper Inference and Fine-tuning for Small Object Detection},
|
91 |
+
author={Akyon, Fatih Cagatay and Altinuc, Sinan Onur and Temizel, Alptekin},
|
92 |
+
journal={2022 IEEE International Conference on Image Processing (ICIP)},
|
93 |
+
doi={10.1109/ICIP46576.2022.9897990},
|
94 |
+
pages={966-970},
|
95 |
+
year={2022}
|
96 |
+
}
|
97 |
+
```
|
98 |
+
```
|
99 |
+
@article{yolox2021,
|
100 |
+
title={{YOLOX}: Exceeding YOLO Series in 2021},
|
101 |
+
author={Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
|
102 |
+
journal={arXiv preprint arXiv:2107.08430},
|
103 |
+
year={2021}
|
104 |
+
}
|
105 |
+
```
|