hermanshid
commited on
Commit
•
bbc91c0
1
Parent(s):
b42df5a
add initiate model
Browse files- README.md +63 -1
- best.pt +3 -0
- config.json +5 -0
- preprocessor_config.json +18 -0
README.md
CHANGED
@@ -1,3 +1,65 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
tags:
|
3 |
+
- ultralyticsplus
|
4 |
+
- yolov5
|
5 |
+
- ultralytics
|
6 |
+
- yolo
|
7 |
+
- vision
|
8 |
+
- object-detection
|
9 |
+
- pytorch
|
10 |
+
- awesome-yolov8-models
|
11 |
+
- indonesia
|
12 |
+
- layout detector
|
13 |
+
|
14 |
+
model-index:
|
15 |
+
- name: hermanshid/yolo-layout-detector
|
16 |
+
results:
|
17 |
+
- task:
|
18 |
+
type: object-detection
|
19 |
+
|
20 |
+
metrics:
|
21 |
+
- type: precision # since mAP@0.5 is not available on hf.co/metrics
|
22 |
+
value: 0.979 # min: 0.0 - max: 1.0
|
23 |
+
name: mAP@0.5(box)
|
24 |
+
inference: false
|
25 |
---
|
26 |
+
|
27 |
+
# YOLOv5 for Layout Detection
|
28 |
+
|
29 |
+
|
30 |
+
## Dataset
|
31 |
+
Dataset available in [kaggle](https://www.kaggle.com/datasets/hermansugiharto/book-layout)
|
32 |
+
## Supported Labels
|
33 |
+
```python
|
34 |
+
["caption", "chart", "image", "image_caption", "table", "table_caption", "text", "title"]
|
35 |
+
```
|
36 |
+
|
37 |
+
## How to use
|
38 |
+
- Install library
|
39 |
+
|
40 |
+
`pip install yolov5==7.0.5 torch`
|
41 |
+
|
42 |
+
## Load model and perform prediction
|
43 |
+
```python
|
44 |
+
import yolov5
|
45 |
+
from PIL import Image
|
46 |
+
|
47 |
+
model = yolov5.load(models_id)
|
48 |
+
|
49 |
+
model.overrides['conf'] = 0.25 # NMS confidence threshold
|
50 |
+
model.overrides['iou'] = 0.45 # NMS IoU threshold
|
51 |
+
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
52 |
+
|
53 |
+
# set image
|
54 |
+
image = 'https://huggingface.co/spaces/hermanshid/yolo-layout-detector-space/raw/main/test_images/example1.jpg'
|
55 |
+
|
56 |
+
# perform inference
|
57 |
+
results = model.predict(image)
|
58 |
+
|
59 |
+
# observe results
|
60 |
+
print(results[0].boxes)
|
61 |
+
render = render_result(model=model, image=image, result=results[0])
|
62 |
+
render.show()
|
63 |
+
|
64 |
+
```
|
65 |
+
|
best.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fee4a91b957e40d09472fb7ba7326aa496e20653250b0b13cc0ca17075e9a650
|
3 |
+
size 18503238
|
config.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"input_size": 640,
|
3 |
+
"task": "object-detection",
|
4 |
+
"model_type": "yolosv5"
|
5 |
+
}
|
preprocessor_config.json
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_normalize": true,
|
3 |
+
"do_resize": true,
|
4 |
+
"feature_extractor_type": "YolosFeatureExtractor",
|
5 |
+
"format": "coco_detection",
|
6 |
+
"image_mean": [
|
7 |
+
0.485,
|
8 |
+
0.456,
|
9 |
+
0.406
|
10 |
+
],
|
11 |
+
"image_std": [
|
12 |
+
0.229,
|
13 |
+
0.224,
|
14 |
+
0.225
|
15 |
+
],
|
16 |
+
"max_size": 1333,
|
17 |
+
"size": 640
|
18 |
+
}
|