Skip to content

Commit 3de2087

Browse files
🎨 Cleaned
1 parent 408f470 commit 3de2087

File tree

1 file changed

+35
-69
lines changed

1 file changed

+35
-69
lines changed
Lines changed: 35 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
2+
"nbformat": 4,
3+
"nbformat_minor": 2,
4+
"metadata": {},
25
"cells": [
36
{
4-
"cell_type": "markdown",
57
"metadata": {},
68
"source": [
7-
"<td>\n",
8-
" <a target=\"_blank\" href=\"https://labelbox.com\" ><img src=\"https://labelbox.com/blog/content/images/2021/02/logo-v4.svg\" width=256/></a>\n",
9+
"<td>",
10+
" <a target=\"_blank\" href=\"https://labelbox.com\" ><img src=\"https://labelbox.com/blog/content/images/2021/02/logo-v4.svg\" width=256/></a>",
911
"</td>\n"
10-
]
12+
],
13+
"cell_type": "markdown"
1114
},
1215
{
13-
"cell_type": "markdown",
1416
"metadata": {},
1517
"source": [
1618
"<td>\n",
@@ -22,10 +24,10 @@
2224
"<a href=\"https://github.com/Labelbox/labelbox-python/tree/develop/examples/integrations/yolo/import_yolo_annotations.ipynb\" target=\"_blank\"><img\n",
2325
"src=\"https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white\" alt=\"GitHub\"></a>\n",
2426
"</td>"
25-
]
27+
],
28+
"cell_type": "markdown"
2629
},
2730
{
28-
"cell_type": "markdown",
2931
"metadata": {},
3032
"source": [
3133
"# Import YOLOv8 annotations\n",
@@ -34,112 +36,76 @@
3436
"* Setting up our ontology that matches our YOLOv8 annotations\n",
3537
"* Importing our data rows and attaching our ontology to a project\n",
3638
"* Running our images through Ultralytics then importing the annotations generated\n"
37-
]
39+
],
40+
"cell_type": "markdown"
3841
},
3942
{
40-
"cell_type": "markdown",
4143
"metadata": {},
4244
"source": [
4345
"## Set up"
44-
]
46+
],
47+
"cell_type": "markdown"
4548
},
4649
{
47-
"cell_type": "code",
48-
"execution_count": null,
4950
"metadata": {},
51+
"source": "%pip install -q --upgrade \"labelbox[data]\"\n%pip install -q --upgrade ultralytics",
52+
"cell_type": "code",
5053
"outputs": [],
51-
"source": [
52-
"%pip install -q --upgrade \"labelbox[data]\"\n",
53-
"%pip install -q --upgrade ultralytics"
54-
]
54+
"execution_count": null
5555
},
5656
{
57-
"cell_type": "code",
58-
"execution_count": null,
5957
"metadata": {},
58+
"source": "import labelbox as lb\nimport labelbox.types as lb_types\nimport uuid\nimport ultralytics\nfrom ultralytics.engine.model import Model\nfrom ultralytics.engine.results import Results",
59+
"cell_type": "code",
6060
"outputs": [],
61-
"source": [
62-
"import labelbox as lb\n",
63-
"import labelbox.types as lb_types\n",
64-
"import uuid\n",
65-
"import ultralytics\n",
66-
"from ultralytics.engine.model import Model\n",
67-
"from ultralytics.engine.results import Results"
68-
]
61+
"execution_count": null
6962
},
7063
{
71-
"cell_type": "markdown",
7264
"metadata": {},
7365
"source": [
7466
"## API key and client\n",
7567
"Provide a valid API key below in order to properly connect to the Labelbox client. Please review [Create API key guide](https://docs.labelbox.com/reference/create-api-key) for more information."
76-
]
68+
],
69+
"cell_type": "markdown"
7770
},
7871
{
79-
"cell_type": "code",
80-
"execution_count": null,
8172
"metadata": {},
73+
"source": "API_KEY = None\nclient = lb.Client(api_key=API_KEY)",
74+
"cell_type": "code",
8275
"outputs": [],
83-
"source": [
84-
"API_KEY = None\n",
85-
"client = lb.Client(api_key=API_KEY)"
86-
]
76+
"execution_count": null
8777
},
8878
{
89-
"cell_type": "markdown",
9079
"metadata": {},
9180
"source": [
9281
"## Example: Import YOLOv8 Annotations\n",
9382
"\n",
9483
"The first few steps of this guide will demonstrating a basic workflow of creating data rows and setting up a project. For a quick complete overview of this process visit our [Quick start](https://docs.labelbox.com/reference/quick-start) guide."
95-
]
84+
],
85+
"cell_type": "markdown"
9686
},
9787
{
98-
"cell_type": "markdown",
9988
"metadata": {},
10089
"source": [
10190
"### Importing an image data row\n",
10291
"\n",
10392
"We will be using this [image](https://storage.googleapis.com/labelbox-datasets/image_sample_data/2560px-Kitano_Street_Kobe01s5s4110.jpeg) to be annotated with YOLOv8. Which has a lot of objects that can be picked up by YOLOv8. Later in this guide we will go into more detail on the exact annotations."
104-
]
93+
],
94+
"cell_type": "markdown"
10595
},
10696
{
107-
"cell_type": "code",
108-
"execution_count": null,
10997
"metadata": {},
98+
"source": "# create data row\ndata_row = {\n \"row_data\":\n \"https://storage.googleapis.com/labelbox-datasets/image_sample_data/2560px-Kitano_Street_Kobe01s5s4110.jpeg\",\n \"global_key\":\n str(uuid.uuid4()),\n \"media_type\":\n \"IMAGE\",\n}\n\n# create dataset and import data row\ndataset = client.create_dataset(name=\"YOLOv8 Demo Dataset\")\ntask = dataset.create_data_rows([data_row])\ntask.wait_till_done()\n\nprint(f\"Errors: {task.errors}\")",
99+
"cell_type": "code",
110100
"outputs": [],
111-
"source": [
112-
"# create data row\n",
113-
"data_row = {\n",
114-
" \"row_data\":\n",
115-
" \"https://storage.googleapis.com/labelbox-datasets/image_sample_data/2560px-Kitano_Street_Kobe01s5s4110.jpeg\",\n",
116-
" \"global_key\":\n",
117-
" str(uuid.uuid4()),\n",
118-
" \"media_type\":\n",
119-
" \"IMAGE\",\n",
120-
"}\n",
121-
"\n",
122-
"# create dataset and import data row\n",
123-
"dataset = client.create_dataset(name=\"YOLOv8 Demo Dataset\")\n",
124-
"task = dataset.create_data_rows([data_row])\n",
125-
"task.wait_till_done()\n",
126-
"\n",
127-
"print(f\"Errors: {task.errors}\")"
128-
]
101+
"execution_count": null
129102
},
130103
{
131-
"cell_type": "markdown",
132104
"metadata": {},
133105
"source": [
134106
"### Setting up an ontology and a project\n"
135-
]
107+
],
108+
"cell_type": "markdown"
136109
}
137-
],
138-
"metadata": {
139-
"language_info": {
140-
"name": "python"
141-
}
142-
},
143-
"nbformat": 4,
144-
"nbformat_minor": 2
145-
}
110+
]
111+
}

0 commit comments

Comments
 (0)