nakamura196 commited on
Commit
ab3b07b
ยท
1 Parent(s): c485cb0

feat: udpate readme

Browse files
Files changed (5) hide show
  1. 01_predict.ipynb +24 -19
  2. README.md +48 -12
  3. config.json +2 -1
  4. default.jpg +0 -0
  5. requirements.txt +1 -2
01_predict.ipynb CHANGED
@@ -2,51 +2,56 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 4,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
9
- "from ultralyticsplus import YOLO, render_result\n",
10
- "import cv2"
11
  ]
12
  },
13
  {
14
  "cell_type": "code",
15
- "execution_count": 10,
16
  "metadata": {},
17
  "outputs": [
18
  {
19
  "name": "stdout",
20
  "output_type": "stream",
21
  "text": [
22
- "Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt to 'yolov8n.pt'...\n"
23
  ]
24
  },
25
  {
26
  "name": "stderr",
27
  "output_type": "stream",
28
  "text": [
29
- "100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 6.23M/6.23M [00:00<00:00, 40.2MB/s]\n"
30
  ]
31
  }
32
  ],
33
  "source": [
34
  "# load model\n",
35
- "model = YOLO('nakamura196/yolov8s-layout-detection')\n",
 
36
  "\n",
37
- "# set model parameters\n",
38
- "model.overrides['conf'] = 0.25 # NMS confidence threshold\n",
39
- "model.overrides['iou'] = 0.45 # NMS IoU threshold\n",
40
- "model.overrides['agnostic_nms'] = False # NMS class-agnostic\n",
41
- "model.overrides['max_det'] = 1000 # maximum number of detections per image"
 
 
 
 
 
 
 
 
 
 
 
 
42
  ]
43
- },
44
- {
45
- "cell_type": "code",
46
- "execution_count": null,
47
- "metadata": {},
48
- "outputs": [],
49
- "source": []
50
  }
51
  ],
52
  "metadata": {
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 140,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
9
+ "from ultralyticsplus import YOLO, render_result"
 
10
  ]
11
  },
12
  {
13
  "cell_type": "code",
14
+ "execution_count": 141,
15
  "metadata": {},
16
  "outputs": [
17
  {
18
  "name": "stdout",
19
  "output_type": "stream",
20
  "text": [
21
+ "Downloading https://dl.ndl.go.jp/api/iiif/1879314/R0000039/full/640,640/0/default.jpg to 'default.jpg'...\n"
22
  ]
23
  },
24
  {
25
  "name": "stderr",
26
  "output_type": "stream",
27
  "text": [
28
+ "100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 152k/152k [00:00<00:00, 6.69MB/s]\n"
29
  ]
30
  }
31
  ],
32
  "source": [
33
  "# load model\n",
34
+ "model = YOLO('best.pt')\n",
35
+ "# model = YOLO(\"nakamura196/yolov8s-layout-detection\")\n",
36
  "\n",
37
+ "# set image\n",
38
+ "image = \"https://dl.ndl.go.jp/api/iiif/1879314/R0000039/full/640,640/0/default.jpg\"\n",
39
+ "\n",
40
+ "filename = image.split(\"/\")[-1]\n",
41
+ "\n",
42
+ "import os\n",
43
+ "\n",
44
+ "if image.startswith(\"http\"):\n",
45
+ "\n",
46
+ " os.remove(filename)\n",
47
+ "\n",
48
+ "# perform inference\n",
49
+ "results = model.predict(image, conf=0.25, verbose=False)\n",
50
+ "\n",
51
+ "# observe results\n",
52
+ "render = render_result(model=model, image=image, result=results[0])\n",
53
+ "render.show()"
54
  ]
 
 
 
 
 
 
 
55
  }
56
  ],
57
  "metadata": {
README.md CHANGED
@@ -1,19 +1,55 @@
1
  ---
2
  tags:
3
- - ultralyticsplus
4
- - yolov8
5
- - ultralytics
6
  library_name: ultralytics
7
  library_version: 8.0.43
8
  license: cc-by-4.0
9
  model-index:
10
- - name: nakamura196/yolov8s-layout-detection
11
- results:
12
- - task:
13
- type: object-detection
14
- metrics:
15
- - type: precision
16
- value: 0.671
17
- name: mAP50-90(B)
 
 
 
18
  pipeline_tag: object-detection
19
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  tags:
3
+ - ultralyticsplus
4
+ - yolov8
5
+ - ultralytics
6
  library_name: ultralytics
7
  library_version: 8.0.43
8
  license: cc-by-4.0
9
  model-index:
10
+ - name: nakamura196/yolov8s-layout-detection
11
+ results:
12
+ - task:
13
+ type: object-detection
14
+ metrics:
15
+ - type: precision
16
+ value: 0.671
17
+ name: mAP50-95(B)
18
+ - type: precision
19
+ value: 0.947
20
+ name: mAP50(B)
21
  pipeline_tag: object-detection
22
+ ---
23
+
24
+ # YOLOv8 model to detect layout of ๅฏ›ๆ”ฟ้‡ไฟฎ่ซธๅฎถ่ญœ
25
+
26
+ ## Inference
27
+
28
+ ### Supported Labels
29
+
30
+ ```python
31
+ ["h1", "h2", "head", "long", "other", "page", "sode", "text", "vol"]
32
+ ```
33
+
34
+ ### How to use
35
+
36
+ ```bash
37
+ pip install ultralyticsplus
38
+ ```
39
+
40
+ ```python
41
+ from ultralyticsplus import YOLO, render_result
42
+
43
+ # load model
44
+ model = YOLO('best.pt')
45
+
46
+ # set image
47
+ image = "https://dl.ndl.go.jp/api/iiif/1879314/R0000039/full/640,640/0/default.jpg"
48
+
49
+ # perform inference
50
+ results = model.predict(image, verbose=False)
51
+
52
+ # observe results
53
+ render = render_result(model=model, image=image, result=results[0])
54
+ render.show()
55
+ ```
config.json CHANGED
@@ -4,5 +4,6 @@
4
  "ultralyticsplus_version": "0.0.24",
5
  "ultralytics_version": "8.0.23",
6
  "model_type": "v8",
7
- "score_map50": 0.20933
 
8
  }
 
4
  "ultralyticsplus_version": "0.0.24",
5
  "ultralytics_version": "8.0.23",
6
  "model_type": "v8",
7
+ "mAP@50": 0.947,
8
+ "mAp@50-95": 0.671
9
  }
default.jpg ADDED
requirements.txt CHANGED
@@ -1,2 +1 @@
1
- ultralyticsplus
2
- ultralytics
 
1
+ ultralyticsplus