nakamura196
commited on
Commit
·
37554e3
1
Parent(s):
5e2c35c
feat: initial commit
Browse files- .gitignore +3 -0
- 01_predict.ipynb +89 -0
- README.md +52 -0
- best.pt +3 -0
- config.json +9 -0
- default.jpg +0 -0
- requirements.txt +1 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
yolov8n.pt
|
3 |
+
.venv
|
01_predict.ipynb
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"from ultralyticsplus import YOLO, render_result"
|
10 |
+
]
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"cell_type": "code",
|
14 |
+
"execution_count": 2,
|
15 |
+
"metadata": {},
|
16 |
+
"outputs": [
|
17 |
+
{
|
18 |
+
"name": "stdout",
|
19 |
+
"output_type": "stream",
|
20 |
+
"text": [
|
21 |
+
"Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt to 'yolov8n.pt'...\n"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"name": "stderr",
|
26 |
+
"output_type": "stream",
|
27 |
+
"text": [
|
28 |
+
"100%|██████████| 6.23M/6.23M [00:00<00:00, 25.2MB/s]\n"
|
29 |
+
]
|
30 |
+
},
|
31 |
+
{
|
32 |
+
"ename": "FileNotFoundError",
|
33 |
+
"evalue": "[Errno 2] No such file or directory: 'default.jpg'",
|
34 |
+
"output_type": "error",
|
35 |
+
"traceback": [
|
36 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
37 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
38 |
+
"Cell \u001b[0;32mIn[2], line 14\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m image\u001b[38;5;241m.\u001b[39mstartswith(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttp\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m---> 14\u001b[0m \u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;66;03m# perform inference\u001b[39;00m\n\u001b[1;32m 17\u001b[0m results \u001b[38;5;241m=\u001b[39m model\u001b[38;5;241m.\u001b[39mpredict(image, conf\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0.25\u001b[39m, verbose\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n",
|
39 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'default.jpg'"
|
40 |
+
]
|
41 |
+
}
|
42 |
+
],
|
43 |
+
"source": [
|
44 |
+
"# load model\n",
|
45 |
+
"model = YOLO('best.pt')\n",
|
46 |
+
"# model = YOLO(\"nakamura196/yolov8s-layout-detection\")\n",
|
47 |
+
"\n",
|
48 |
+
"# set image\n",
|
49 |
+
"image = \"https://dl.ndl.go.jp/api/iiif/1879314/R0000039/full/640,640/0/default.jpg\"\n",
|
50 |
+
"\n",
|
51 |
+
"filename = image.split(\"/\")[-1]\n",
|
52 |
+
"\n",
|
53 |
+
"import os\n",
|
54 |
+
"\n",
|
55 |
+
"if image.startswith(\"http\"):\n",
|
56 |
+
" if os.path.exists(filename):\n",
|
57 |
+
" os.remove(filename)\n",
|
58 |
+
"\n",
|
59 |
+
"# perform inference\n",
|
60 |
+
"results = model.predict(image, conf=0.25, verbose=False)\n",
|
61 |
+
"\n",
|
62 |
+
"# observe results\n",
|
63 |
+
"render = render_result(model=model, image=image, result=results[0])\n",
|
64 |
+
"render.show()"
|
65 |
+
]
|
66 |
+
}
|
67 |
+
],
|
68 |
+
"metadata": {
|
69 |
+
"kernelspec": {
|
70 |
+
"display_name": ".venv",
|
71 |
+
"language": "python",
|
72 |
+
"name": "python3"
|
73 |
+
},
|
74 |
+
"language_info": {
|
75 |
+
"codemirror_mode": {
|
76 |
+
"name": "ipython",
|
77 |
+
"version": 3
|
78 |
+
},
|
79 |
+
"file_extension": ".py",
|
80 |
+
"mimetype": "text/x-python",
|
81 |
+
"name": "python",
|
82 |
+
"nbconvert_exporter": "python",
|
83 |
+
"pygments_lexer": "ipython3",
|
84 |
+
"version": "3.9.11"
|
85 |
+
}
|
86 |
+
},
|
87 |
+
"nbformat": 4,
|
88 |
+
"nbformat_minor": 2
|
89 |
+
}
|
README.md
CHANGED
@@ -1,3 +1,55 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: cc-by-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/yolov8m-wavy-line-detection
|
11 |
+
results:
|
12 |
+
- task:
|
13 |
+
type: object-detection
|
14 |
+
metrics:
|
15 |
+
- type: precision
|
16 |
+
value: 0.566
|
17 |
+
name: mAP50-95(B)
|
18 |
+
- type: precision
|
19 |
+
value: 0.925
|
20 |
+
name: mAP50(B)
|
21 |
+
pipeline_tag: object-detection
|
22 |
---
|
23 |
+
|
24 |
+
# YOLOv8 model to detect wavy lines in images
|
25 |
+
|
26 |
+
## Inference
|
27 |
+
|
28 |
+
### Supported Labels
|
29 |
+
|
30 |
+
```python
|
31 |
+
["line"]
|
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 |
+
```
|
best.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8684c96c30592d3fe3097168428499eebf8b5577fc19000f2e5741b57eef8a4b
|
3 |
+
size 52036310
|
config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"input_size": 640,
|
3 |
+
"task": "object-detection",
|
4 |
+
"ultralyticsplus_version": "0.0.24",
|
5 |
+
"ultralytics_version": "8.0.23",
|
6 |
+
"model_type": "v8",
|
7 |
+
"mAP@50": 0.925,
|
8 |
+
"mAp@50-95": 0.566
|
9 |
+
}
|
default.jpg
ADDED
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ultralyticsplus
|