Zencriel commited on
Commit
7370e5c
1 Parent(s): 53ea4d1

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .idea/.gitignore +3 -0
  2. .idea/.name +1 -0
  3. .idea/Brain Tumour Detection.iml +8 -0
  4. .idea/inspectionProfiles/Project_Default.xml +12 -0
  5. .idea/inspectionProfiles/profiles_settings.xml +6 -0
  6. .idea/misc.xml +7 -0
  7. .idea/modules.xml +8 -0
  8. .idea/vcs.xml +7 -0
  9. .idea/workspace.xml +58 -0
  10. README.md +2 -8
  11. app.py +22 -0
  12. best.pt +3 -0
  13. requirements.txt +3 -0
  14. ultralytics/.github/ISSUE_TEMPLATE/bug-report.yml +97 -0
  15. ultralytics/.github/ISSUE_TEMPLATE/config.yml +13 -0
  16. ultralytics/.github/ISSUE_TEMPLATE/feature-request.yml +52 -0
  17. ultralytics/.github/ISSUE_TEMPLATE/question.yml +35 -0
  18. ultralytics/.github/dependabot.yml +27 -0
  19. ultralytics/.github/workflows/ci.yaml +348 -0
  20. ultralytics/.github/workflows/cla.yml +44 -0
  21. ultralytics/.github/workflows/codeql.yaml +42 -0
  22. ultralytics/.github/workflows/docker.yaml +186 -0
  23. ultralytics/.github/workflows/docs.yml +101 -0
  24. ultralytics/.github/workflows/format.yml +29 -0
  25. ultralytics/.github/workflows/greetings.yml +58 -0
  26. ultralytics/.github/workflows/links.yml +93 -0
  27. ultralytics/.github/workflows/merge-main-into-prs.yml +91 -0
  28. ultralytics/.github/workflows/publish.yml +206 -0
  29. ultralytics/.github/workflows/stale.yml +47 -0
  30. ultralytics/.gitignore +172 -0
  31. ultralytics/CITATION.cff +26 -0
  32. ultralytics/CONTRIBUTING.md +166 -0
  33. ultralytics/LICENSE +661 -0
  34. ultralytics/README.md +297 -0
  35. ultralytics/README.zh-CN.md +299 -0
  36. ultralytics/docker/Dockerfile +89 -0
  37. ultralytics/docker/Dockerfile-arm64 +54 -0
  38. ultralytics/docker/Dockerfile-conda +46 -0
  39. ultralytics/docker/Dockerfile-cpu +60 -0
  40. ultralytics/docker/Dockerfile-jetson-jetpack4 +65 -0
  41. ultralytics/docker/Dockerfile-jetson-jetpack5 +59 -0
  42. ultralytics/docker/Dockerfile-jetson-jetpack6 +55 -0
  43. ultralytics/docker/Dockerfile-python +57 -0
  44. ultralytics/docker/Dockerfile-runner +45 -0
  45. ultralytics/docs/README.md +146 -0
  46. ultralytics/docs/build_docs.py +258 -0
  47. ultralytics/docs/build_reference.py +147 -0
  48. ultralytics/docs/coming_soon_template.md +34 -0
  49. ultralytics/docs/en/CNAME +1 -0
  50. ultralytics/docs/en/datasets/classify/caltech101.md +149 -0
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
.idea/.name ADDED
@@ -0,0 +1 @@
 
 
1
+ app.py
.idea/Brain Tumour Detection.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="ignoredIdentifiers">
6
+ <list>
7
+ <option value="PySimpleGUI.theme" />
8
+ </list>
9
+ </option>
10
+ </inspection_tool>
11
+ </profile>
12
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.12" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
7
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/Brain Tumour Detection.iml" filepath="$PROJECT_DIR$/.idea/Brain Tumour Detection.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/ultralytics" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$/yolov10" vcs="Git" />
6
+ </component>
7
+ </project>
.idea/workspace.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="a00cec43-ea7e-44c4-982a-0a3b53cb6483" name="Changes" comment="" />
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="FileTemplateManagerImpl">
14
+ <option name="RECENT_TEMPLATES">
15
+ <list>
16
+ <option value="Python Script" />
17
+ </list>
18
+ </option>
19
+ </component>
20
+ <component name="Git.Settings">
21
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/yolov10" />
22
+ </component>
23
+ <component name="ProjectColorInfo">{
24
+ &quot;associatedIndex&quot;: 3
25
+ }</component>
26
+ <component name="ProjectId" id="2lC0Vj1vunwOmRgkbP5L9Q37LQE" />
27
+ <component name="ProjectViewState">
28
+ <option name="hideEmptyMiddlePackages" value="true" />
29
+ <option name="showLibraryContents" value="true" />
30
+ </component>
31
+ <component name="PropertiesComponent">{
32
+ &quot;keyToString&quot;: {
33
+ &quot;Python.app.executor&quot;: &quot;Run&quot;,
34
+ &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
35
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
36
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
37
+ &quot;last_opened_file_path&quot;: &quot;C:/Users/suhri/Documents/Brain Tumour Detection&quot;
38
+ }
39
+ }</component>
40
+ <component name="SharedIndexes">
41
+ <attachedChunks>
42
+ <set>
43
+ <option value="bundled-python-sdk-5a2391486177-d3b881c8e49f-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-233.13763.11" />
44
+ </set>
45
+ </attachedChunks>
46
+ </component>
47
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
48
+ <component name="TaskManager">
49
+ <task active="true" id="Default" summary="Default task">
50
+ <changelist id="a00cec43-ea7e-44c4-982a-0a3b53cb6483" name="Changes" comment="" />
51
+ <created>1724668778161</created>
52
+ <option name="number" value="Default" />
53
+ <option name="presentableId" value="Default" />
54
+ <updated>1724668778161</updated>
55
+ </task>
56
+ <servers />
57
+ </component>
58
+ </project>
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: Brain Tumour Detection
3
- emoji: 📚
4
- colorFrom: pink
5
- colorTo: red
6
  sdk: gradio
7
  sdk_version: 4.42.0
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Brain_Tumour_Detection
3
+ app_file: app.py
 
 
4
  sdk: gradio
5
  sdk_version: 4.42.0
 
 
6
  ---
 
 
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import joblib
4
+ from ultralytics import YOLO
5
+
6
+ load_model = YOLO("best.pt")
7
+
8
+ def predict(image):
9
+ result = load_model.predict(source=image, imgsz = 640, conf = 0.25)
10
+ annotated_img = result[0].plot()
11
+ annotated_img = annotated_img[:, :, ::-1]
12
+ return annotated_img
13
+
14
+ app = gr.Interface(
15
+ fn = predict,
16
+ inputs = gr.Image(type="numpy", label="Upload an image"),
17
+ outputs = gr.Image(type="numpy", label="Detect Brain Tumor"),
18
+ title = "Brain Tumor Detection",
19
+ description="Upload an image. The model will detect and annotate brain tumor."
20
+ )
21
+
22
+ app.launch(share = True)
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e407241a5f7694b5901d772875845937881b9f1b2f50bb0311eff3e214d88c6d
3
+ size 5751283
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ultralytics == 8.2.82
2
+ joblib == 1.4.2
3
+ numpy == 1.26.4
ultralytics/.github/ISSUE_TEMPLATE/bug-report.yml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: 🐛 Bug Report
4
+ # title: " "
5
+ description: Problems with Ultralytics YOLO
6
+ labels: [bug, triage]
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ Thank you for submitting an Ultralytics YOLO 🐛 Bug Report!
12
+
13
+ - type: checkboxes
14
+ attributes:
15
+ label: Search before asking
16
+ description: >
17
+ Please search the Ultralytics [Docs](https://docs.ultralytics.com) and [issues](https://github.com/ultralytics/ultralytics/issues) to see if a similar bug report already exists.
18
+ options:
19
+ - label: >
20
+ I have searched the Ultralytics YOLO [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar bug report.
21
+ required: true
22
+
23
+ - type: dropdown
24
+ attributes:
25
+ label: Ultralytics YOLO Component
26
+ description: |
27
+ Please select the Ultralytics YOLO component where you found the bug.
28
+ multiple: true
29
+ options:
30
+ - "Install"
31
+ - "Train"
32
+ - "Val"
33
+ - "Predict"
34
+ - "Export"
35
+ - "Multi-GPU"
36
+ - "Augmentation"
37
+ - "Hyperparameter Tuning"
38
+ - "Integrations"
39
+ - "Other"
40
+ validations:
41
+ required: false
42
+
43
+ - type: textarea
44
+ attributes:
45
+ label: Bug
46
+ description: Please provide as much information as possible. Copy and paste console output and error messages. Use [Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to format text, code and logs. If necessary, include screenshots for visual elements only. Providing detailed information will help us resolve the issue more efficiently.
47
+ placeholder: |
48
+ 💡 ProTip! Include as much information as possible (logs, tracebacks, screenshots, etc.) to receive the most helpful response.
49
+ validations:
50
+ required: true
51
+
52
+ - type: textarea
53
+ attributes:
54
+ label: Environment
55
+ description: Many issues are often related to dependency versions and hardware. Please provide the output of `yolo checks` or `ultralytics.checks()` command to help us diagnose the problem.
56
+ placeholder: |
57
+ Paste output of `yolo checks` or `ultralytics.checks()` command, i.e.:
58
+ ```
59
+ Ultralytics YOLOv8.0.181 🚀 Python-3.11.2 torch-2.0.1 CPU (Apple M2)
60
+ Setup complete ✅ (8 CPUs, 16.0 GB RAM, 266.5/460.4 GB disk)
61
+
62
+ OS macOS-13.5.2
63
+ Environment Jupyter
64
+ Python 3.11.2
65
+ Install git
66
+ RAM 16.00 GB
67
+ CPU Apple M2
68
+ CUDA None
69
+ ```
70
+ validations:
71
+ required: true
72
+
73
+ - type: textarea
74
+ attributes:
75
+ label: Minimal Reproducible Example
76
+ description: >
77
+ When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to **reproduce** the problem. This is referred to by community members as creating a [minimal reproducible example](https://docs.ultralytics.com/help/minimum_reproducible_example/).
78
+ placeholder: |
79
+ ```
80
+ # Code to reproduce your issue here
81
+ ```
82
+ validations:
83
+ required: true
84
+
85
+ - type: textarea
86
+ attributes:
87
+ label: Additional
88
+ description: Anything else you would like to share?
89
+
90
+ - type: checkboxes
91
+ attributes:
92
+ label: Are you willing to submit a PR?
93
+ description: >
94
+ (Optional) We encourage you to submit a [Pull Request](https://github.com/ultralytics/ultralytics/pulls) (PR) to help improve Ultralytics YOLO for everyone, especially if you have a good understanding of how to implement a fix or feature.
95
+ See the Ultralytics YOLO [Contributing Guide](https://docs.ultralytics.com/help/contributing) to get started.
96
+ options:
97
+ - label: Yes I'd like to help by submitting a PR!
ultralytics/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ blank_issues_enabled: true
4
+ contact_links:
5
+ - name: 📄 Docs
6
+ url: https://docs.ultralytics.com/
7
+ about: Full Ultralytics YOLOv8 Documentation
8
+ - name: 💬 Forum
9
+ url: https://community.ultralytics.com/
10
+ about: Ask on Ultralytics Community Forum
11
+ - name: 🎧 Discord
12
+ url: https://ultralytics.com/discord
13
+ about: Ask on Ultralytics Discord
ultralytics/.github/ISSUE_TEMPLATE/feature-request.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: 🚀 Feature Request
4
+ description: Suggest a YOLOv8 idea
5
+ # title: " "
6
+ labels: [enhancement]
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ Thank you for submitting a YOLOv8 🚀 Feature Request!
12
+
13
+ - type: checkboxes
14
+ attributes:
15
+ label: Search before asking
16
+ description: >
17
+ Please search the Ultralytics [Docs](https://docs.ultralytics.com) and [issues](https://github.com/ultralytics/ultralytics/issues) to see if a similar feature request already exists.
18
+ options:
19
+ - label: >
20
+ I have searched the YOLOv8 [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar feature requests.
21
+ required: true
22
+
23
+ - type: textarea
24
+ attributes:
25
+ label: Description
26
+ description: A short description of your feature.
27
+ placeholder: |
28
+ What new feature would you like to see in YOLOv8?
29
+ validations:
30
+ required: true
31
+
32
+ - type: textarea
33
+ attributes:
34
+ label: Use case
35
+ description: |
36
+ Describe the use case of your feature request. It will help us understand and prioritize the feature request.
37
+ placeholder: |
38
+ How would this feature be used, and who would use it?
39
+
40
+ - type: textarea
41
+ attributes:
42
+ label: Additional
43
+ description: Anything else you would like to share?
44
+
45
+ - type: checkboxes
46
+ attributes:
47
+ label: Are you willing to submit a PR?
48
+ description: >
49
+ (Optional) We encourage you to submit a [Pull Request](https://github.com/ultralytics/ultralytics/pulls) (PR) to help improve YOLOv8 for everyone, especially if you have a good understanding of how to implement a fix or feature.
50
+ See the YOLOv8 [Contributing Guide](https://docs.ultralytics.com/help/contributing) to get started.
51
+ options:
52
+ - label: Yes I'd like to help by submitting a PR!
ultralytics/.github/ISSUE_TEMPLATE/question.yml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: ❓ Question
4
+ description: Ask an Ultralytics YOLO question
5
+ # title: " "
6
+ labels: [question]
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ Thank you for asking an Ultralytics YOLO ❓ Question!
12
+
13
+ - type: checkboxes
14
+ attributes:
15
+ label: Search before asking
16
+ description: >
17
+ Please search the Ultralytics [Docs](https://docs.ultralytics.com), [issues](https://github.com/ultralytics/ultralytics/issues) and [discussions](https://github.com/ultralytics/ultralytics/discussions) to see if a similar question already exists.
18
+ options:
19
+ - label: >
20
+ I have searched the Ultralytics YOLO [issues](https://github.com/ultralytics/ultralytics/issues) and [discussions](https://github.com/ultralytics/ultralytics/discussions) and found no similar questions.
21
+ required: true
22
+
23
+ - type: textarea
24
+ attributes:
25
+ label: Question
26
+ description: What is your question? Please provide as much information as possible. Include detailed code examples to reproduce the problem and describe the context in which the issue occurs. Format your text and code using [Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for clarity and readability. Following these guidelines will help us assist you more effectively.
27
+ placeholder: |
28
+ 💡 ProTip! Include as much information as possible (logs, tracebacks, screenshots etc.) to receive the most helpful response.
29
+ validations:
30
+ required: true
31
+
32
+ - type: textarea
33
+ attributes:
34
+ label: Additional
35
+ description: Anything else you would like to share?
ultralytics/.github/dependabot.yml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Dependabot for package version updates
3
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
4
+
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: pip
8
+ directory: "/"
9
+ schedule:
10
+ interval: weekly
11
+ time: "04:00"
12
+ open-pull-requests-limit: 10
13
+ reviewers:
14
+ - glenn-jocher
15
+ labels:
16
+ - dependencies
17
+
18
+ - package-ecosystem: github-actions
19
+ directory: "/.github/workflows"
20
+ schedule:
21
+ interval: weekly
22
+ time: "04:00"
23
+ open-pull-requests-limit: 5
24
+ reviewers:
25
+ - glenn-jocher
26
+ labels:
27
+ - dependencies
ultralytics/.github/workflows/ci.yaml ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # YOLO Continuous Integration (CI) GitHub Actions tests
3
+
4
+ name: Ultralytics CI
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+ branches: [main]
11
+ schedule:
12
+ - cron: "0 0 * * *" # runs at 00:00 UTC every day
13
+ workflow_dispatch:
14
+ inputs:
15
+ hub:
16
+ description: "Run HUB"
17
+ default: false
18
+ type: boolean
19
+ benchmarks:
20
+ description: "Run Benchmarks"
21
+ default: false
22
+ type: boolean
23
+ tests:
24
+ description: "Run Tests"
25
+ default: false
26
+ type: boolean
27
+ gpu:
28
+ description: "Run GPU"
29
+ default: false
30
+ type: boolean
31
+ raspberrypi:
32
+ description: "Run Raspberry Pi"
33
+ default: false
34
+ type: boolean
35
+ conda:
36
+ description: "Run Conda"
37
+ default: false
38
+ type: boolean
39
+
40
+ jobs:
41
+ HUB:
42
+ if: github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.hub == 'true'))
43
+ runs-on: ${{ matrix.os }}
44
+ strategy:
45
+ fail-fast: false
46
+ matrix:
47
+ os: [ubuntu-latest]
48
+ python-version: ["3.11"]
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ - uses: actions/setup-python@v5
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+ cache: "pip" # caching pip dependencies
55
+ - name: Install requirements
56
+ shell: bash # for Windows compatibility
57
+ run: |
58
+ python -m pip install --upgrade pip wheel
59
+ pip install -e . --extra-index-url https://download.pytorch.org/whl/cpu
60
+ - name: Check environment
61
+ run: |
62
+ yolo checks
63
+ pip list
64
+ - name: Test HUB training
65
+ shell: python
66
+ env:
67
+ API_KEY: ${{ secrets.ULTRALYTICS_HUB_API_KEY }}
68
+ MODEL_ID: ${{ secrets.ULTRALYTICS_HUB_MODEL_ID }}
69
+ run: |
70
+ import os
71
+ from ultralytics import YOLO, hub
72
+ api_key, model_id = os.environ['API_KEY'], os.environ['MODEL_ID']
73
+ hub.login(api_key)
74
+ hub.reset_model(model_id)
75
+ model = YOLO('https://hub.ultralytics.com/models/' + model_id)
76
+ model.train()
77
+ - name: Test HUB inference API
78
+ shell: python
79
+ env:
80
+ API_KEY: ${{ secrets.ULTRALYTICS_HUB_API_KEY }}
81
+ MODEL_ID: ${{ secrets.ULTRALYTICS_HUB_MODEL_ID }}
82
+ run: |
83
+ import os
84
+ import requests
85
+ import json
86
+ api_key, model_id = os.environ['API_KEY'], os.environ['MODEL_ID']
87
+ url = f"https://api.ultralytics.com/v1/predict/{model_id}"
88
+ headers = {"x-api-key": api_key}
89
+ data = {"size": 320, "confidence": 0.25, "iou": 0.45}
90
+ with open("ultralytics/assets/zidane.jpg", "rb") as f:
91
+ response = requests.post(url, headers=headers, data=data, files={"image": f})
92
+ assert response.status_code == 200, f'Status code {response.status_code}, Reason {response.reason}'
93
+ print(json.dumps(response.json(), indent=2))
94
+
95
+ Benchmarks:
96
+ if: github.event_name != 'workflow_dispatch' || github.event.inputs.benchmarks == 'true'
97
+ runs-on: ${{ matrix.os }}
98
+ strategy:
99
+ fail-fast: false
100
+ matrix:
101
+ os: [ubuntu-latest, macos-14]
102
+ python-version: ["3.11"]
103
+ model: [yolov8n]
104
+ steps:
105
+ - uses: actions/checkout@v4
106
+ - uses: actions/setup-python@v5
107
+ with:
108
+ python-version: ${{ matrix.python-version }}
109
+ cache: "pip" # caching pip dependencies
110
+ - name: Install requirements
111
+ shell: bash # for Windows compatibility
112
+ run: |
113
+ python -m pip install --upgrade pip wheel
114
+ pip install -e ".[export]" "coverage[toml]" --extra-index-url https://download.pytorch.org/whl/cpu
115
+ - name: Check environment
116
+ run: |
117
+ yolo checks
118
+ pip list
119
+ - name: Benchmark ClassificationModel
120
+ shell: bash
121
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-cls.pt' imgsz=160 verbose=0.166
122
+ - name: Benchmark YOLOWorld DetectionModel
123
+ shell: bash
124
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/yolov8s-worldv2.pt' imgsz=160 verbose=0.318
125
+ - name: Benchmark SegmentationModel
126
+ shell: bash
127
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-seg.pt' imgsz=160 verbose=0.279
128
+ - name: Benchmark PoseModel
129
+ shell: bash
130
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-pose.pt' imgsz=160 verbose=0.183
131
+ - name: Benchmark OBBModel
132
+ shell: bash
133
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-obb.pt' imgsz=160 verbose=0.472
134
+ - name: Benchmark YOLOv10Model
135
+ shell: bash
136
+ run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/yolov10n.pt' imgsz=160 verbose=0.178
137
+ - name: Merge Coverage Reports
138
+ run: |
139
+ coverage xml -o coverage-benchmarks.xml
140
+ - name: Upload Coverage Reports to CodeCov
141
+ if: github.repository == 'ultralytics/ultralytics'
142
+ uses: codecov/codecov-action@v4
143
+ with:
144
+ flags: Benchmarks
145
+ env:
146
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
147
+ - name: Benchmark Summary
148
+ run: |
149
+ cat benchmarks.log
150
+ echo "$(cat benchmarks.log)" >> $GITHUB_STEP_SUMMARY
151
+
152
+ Tests:
153
+ if: github.event_name != 'workflow_dispatch' || github.event.inputs.tests == 'true'
154
+ timeout-minutes: 360
155
+ runs-on: ${{ matrix.os }}
156
+ strategy:
157
+ fail-fast: false
158
+ matrix:
159
+ os: [ubuntu-latest, macos-14]
160
+ python-version: ["3.11"]
161
+ torch: [latest]
162
+ include:
163
+ - os: ubuntu-latest
164
+ python-version: "3.8" # torch 1.8.0 requires python >=3.6, <=3.8
165
+ torch: "1.8.0" # min torch version CI https://pypi.org/project/torchvision/
166
+ steps:
167
+ - uses: actions/checkout@v4
168
+ - uses: actions/setup-python@v5
169
+ with:
170
+ python-version: ${{ matrix.python-version }}
171
+ cache: "pip" # caching pip dependencies
172
+ - name: Install requirements
173
+ shell: bash # for Windows compatibility
174
+ run: |
175
+ # CoreML must be installed before export due to protobuf error from AutoInstall
176
+ python -m pip install --upgrade pip wheel
177
+ slow=""
178
+ torch=""
179
+ if [ "${{ matrix.torch }}" == "1.8.0" ]; then
180
+ torch="torch==1.8.0 torchvision==0.9.0"
181
+ fi
182
+ if [[ "${{ github.event_name }}" =~ ^(schedule|workflow_dispatch)$ ]]; then
183
+ slow="pycocotools mlflow ray[tune]"
184
+ fi
185
+ pip install -e ".[export]" $torch $slow pytest-cov --extra-index-url https://download.pytorch.org/whl/cpu
186
+ - name: Check environment
187
+ run: |
188
+ yolo checks
189
+ pip list
190
+ - name: Pytest tests
191
+ shell: bash # for Windows compatibility
192
+ run: |
193
+ slow=""
194
+ if [[ "${{ github.event_name }}" =~ ^(schedule|workflow_dispatch)$ ]]; then
195
+ slow="--slow"
196
+ fi
197
+ pytest $slow --cov=ultralytics/ --cov-report xml tests/
198
+ - name: Upload Coverage Reports to CodeCov
199
+ if: github.repository == 'ultralytics/ultralytics' # && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
200
+ uses: codecov/codecov-action@v4
201
+ with:
202
+ flags: Tests
203
+ env:
204
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
205
+
206
+ GPU:
207
+ if: github.repository == 'ultralytics/ultralytics' && (github.event_name != 'workflow_dispatch' || github.event.inputs.gpu == 'true')
208
+ timeout-minutes: 360
209
+ runs-on: gpu-latest
210
+ steps:
211
+ - uses: actions/checkout@v4
212
+ - name: Install requirements
213
+ run: pip install -e . pytest-cov
214
+ - name: Check environment
215
+ run: |
216
+ yolo checks
217
+ pip list
218
+ - name: Pytest tests
219
+ run: |
220
+ slow=""
221
+ if [[ "${{ github.event_name }}" =~ ^(schedule|workflow_dispatch)$ ]]; then
222
+ slow="--slow"
223
+ fi
224
+ pytest $slow --cov=ultralytics/ --cov-report xml tests/test_cuda.py
225
+ - name: Upload Coverage Reports to CodeCov
226
+ uses: codecov/codecov-action@v4
227
+ with:
228
+ flags: GPU
229
+ env:
230
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
231
+
232
+ RaspberryPi:
233
+ if: github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event.inputs.raspberrypi == 'true')
234
+ timeout-minutes: 120
235
+ runs-on: raspberry-pi
236
+ steps:
237
+ - uses: actions/checkout@v4
238
+ - name: Activate Virtual Environment
239
+ run: |
240
+ python3.11 -m venv env
241
+ source env/bin/activate
242
+ echo PATH=$PATH >> $GITHUB_ENV
243
+ - name: Install requirements
244
+ run: |
245
+ python -m pip install --upgrade pip wheel
246
+ pip install -e ".[export]" pytest mlflow pycocotools "ray[tune]"
247
+ - name: Check environment
248
+ run: |
249
+ yolo checks
250
+ pip list
251
+ - name: Pytest tests
252
+ run: pytest --slow tests/
253
+ - name: Benchmark ClassificationModel
254
+ run: python -m ultralytics.cfg.__init__ benchmark model='yolov8n-cls.pt' imgsz=160 verbose=0.166
255
+ - name: Benchmark YOLOWorld DetectionModel
256
+ run: python -m ultralytics.cfg.__init__ benchmark model='yolov8s-worldv2.pt' imgsz=160 verbose=0.318
257
+ - name: Benchmark SegmentationModel
258
+ run: python -m ultralytics.cfg.__init__ benchmark model='yolov8n-seg.pt' imgsz=160 verbose=0.267
259
+ - name: Benchmark PoseModel
260
+ run: python -m ultralytics.cfg.__init__ benchmark model='yolov8n-pose.pt' imgsz=160 verbose=0.179
261
+ - name: Benchmark OBBModel
262
+ run: python -m ultralytics.cfg.__init__ benchmark model='yolov8n-obb.pt' imgsz=160 verbose=0.472
263
+ - name: Benchmark Summary
264
+ run: |
265
+ cat benchmarks.log
266
+ echo "$(cat benchmarks.log)" >> $GITHUB_STEP_SUMMARY
267
+ - name: Reboot # run a reboot command in the background to free resources for next run and not crash main thread
268
+ run: sudo bash -c "sleep 10; reboot" &
269
+
270
+ Conda:
271
+ if: github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event.inputs.conda == 'true')
272
+ runs-on: ${{ matrix.os }}
273
+ strategy:
274
+ fail-fast: false
275
+ matrix:
276
+ os: [ubuntu-latest]
277
+ python-version: ["3.11"]
278
+ defaults:
279
+ run:
280
+ shell: bash -el {0}
281
+ steps:
282
+ - uses: conda-incubator/setup-miniconda@v3
283
+ with:
284
+ python-version: ${{ matrix.python-version }}
285
+ mamba-version: "*"
286
+ channels: conda-forge,defaults
287
+ channel-priority: true
288
+ activate-environment: anaconda-client-env
289
+ - name: Cleanup toolcache
290
+ run: |
291
+ echo "Free space before deletion:"
292
+ df -h /
293
+ rm -rf /opt/hostedtoolcache
294
+ echo "Free space after deletion:"
295
+ df -h /
296
+ - name: Install Linux packages
297
+ run: |
298
+ # Fix cv2 ImportError: 'libEGL.so.1: cannot open shared object file: No such file or directory'
299
+ sudo apt-get update
300
+ sudo apt-get install -y libegl1 libopengl0
301
+ - name: Install Libmamba
302
+ run: |
303
+ conda config --set solver libmamba
304
+ - name: Install Ultralytics package from conda-forge
305
+ run: |
306
+ conda install -c pytorch -c conda-forge pytorch torchvision ultralytics openvino
307
+ - name: Install pip packages
308
+ run: |
309
+ # CoreML must be installed before export due to protobuf error from AutoInstall
310
+ pip install pytest "coremltools>=7.0; platform_system != 'Windows' and python_version <= '3.11'"
311
+ - name: Check environment
312
+ run: |
313
+ conda list
314
+ - name: Test CLI
315
+ run: |
316
+ yolo predict model=yolov8n.pt imgsz=320
317
+ yolo train model=yolov8n.pt data=coco8.yaml epochs=1 imgsz=32
318
+ yolo val model=yolov8n.pt data=coco8.yaml imgsz=32
319
+ yolo export model=yolov8n.pt format=torchscript imgsz=160
320
+ - name: Test Python
321
+ # Note this step must use the updated default bash environment, not a python environment
322
+ run: |
323
+ python -c "
324
+ from ultralytics import YOLO
325
+ model = YOLO('yolov8n.pt')
326
+ results = model.train(data='coco8.yaml', epochs=3, imgsz=160)
327
+ results = model.val(imgsz=160)
328
+ results = model.predict(imgsz=160)
329
+ results = model.export(format='onnx', imgsz=160)
330
+ "
331
+ - name: PyTest
332
+ run: |
333
+ git clone https://github.com/ultralytics/ultralytics
334
+ pytest ultralytics/tests
335
+
336
+ Summary:
337
+ runs-on: ubuntu-latest
338
+ needs: [HUB, Benchmarks, Tests, GPU, RaspberryPi, Conda] # Add job names that you want to check for failure
339
+ if: always() # This ensures the job runs even if previous jobs fail
340
+ steps:
341
+ - name: Check for failure and notify
342
+ if: (needs.HUB.result == 'failure' || needs.Benchmarks.result == 'failure' || needs.Tests.result == 'failure' || needs.GPU.result == 'failure' || needs.RaspberryPi.result == 'failure' || needs.Conda.result == 'failure' ) && github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push')
343
+ uses: slackapi/slack-github-action@v1.26.0
344
+ with:
345
+ payload: |
346
+ {"text": "<!channel> GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n"}
347
+ env:
348
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }}
ultralytics/.github/workflows/cla.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Ultralytics Contributor License Agreement (CLA) action https://docs.ultralytics.com/help/CLA
3
+ # This workflow automatically requests Pull Requests (PR) authors to sign the Ultralytics CLA before PRs can be merged
4
+
5
+ name: CLA Assistant
6
+ on:
7
+ issue_comment:
8
+ types:
9
+ - created
10
+ pull_request_target:
11
+ types:
12
+ - reopened
13
+ - opened
14
+ - synchronize
15
+
16
+ permissions:
17
+ actions: write
18
+ contents: write
19
+ pull-requests: write
20
+ statuses: write
21
+
22
+ jobs:
23
+ CLA:
24
+ if: github.repository == 'ultralytics/ultralytics'
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: CLA Assistant
28
+ if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I sign the CLA') || github.event_name == 'pull_request_target'
29
+ uses: contributor-assistant/github-action@v2.5.1
30
+ env:
31
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
+ # Must be repository secret PAT
33
+ PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
34
+ with:
35
+ path-to-signatures: "signatures/version1/cla.json"
36
+ path-to-document: "https://docs.ultralytics.com/help/CLA" # CLA document
37
+ # Branch must not be protected
38
+ branch: cla-signatures
39
+ allowlist: dependabot[bot],github-actions,[pre-commit*,pre-commit*,bot*
40
+
41
+ remote-organization-name: ultralytics
42
+ remote-repository-name: cla
43
+ custom-pr-sign-comment: "I have read the CLA Document and I sign the CLA"
44
+ custom-allsigned-prcomment: All Contributors have signed the CLA. ✅
ultralytics/.github/workflows/codeql.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: "CodeQL"
4
+
5
+ on:
6
+ schedule:
7
+ - cron: "0 0 1 * *"
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ analyze:
12
+ name: Analyze
13
+ runs-on: ${{ 'ubuntu-latest' }}
14
+ permissions:
15
+ actions: read
16
+ contents: read
17
+ security-events: write
18
+
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ language: ["python"]
23
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
24
+
25
+ steps:
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v4
28
+
29
+ # Initializes the CodeQL tools for scanning.
30
+ - name: Initialize CodeQL
31
+ uses: github/codeql-action/init@v3
32
+ with:
33
+ languages: ${{ matrix.language }}
34
+ # If you wish to specify custom queries, you can do so here or in a config file.
35
+ # By default, queries listed here will override any specified in a config file.
36
+ # Prefix the list here with "+" to use these queries and those in the config file.
37
+ # queries: security-extended,security-and-quality
38
+
39
+ - name: Perform CodeQL Analysis
40
+ uses: github/codeql-action/analyze@v3
41
+ with:
42
+ category: "/language:${{matrix.language}}"
ultralytics/.github/workflows/docker.yaml ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest images on DockerHub https://hub.docker.com/r/ultralytics
3
+
4
+ name: Publish Docker Images
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ paths-ignore:
10
+ - "docs/**"
11
+ - "mkdocs.yml"
12
+ workflow_dispatch:
13
+ inputs:
14
+ Dockerfile:
15
+ type: boolean
16
+ description: Use Dockerfile
17
+ default: true
18
+ Dockerfile-cpu:
19
+ type: boolean
20
+ description: Use Dockerfile-cpu
21
+ default: true
22
+ Dockerfile-arm64:
23
+ type: boolean
24
+ description: Use Dockerfile-arm64
25
+ default: true
26
+ Dockerfile-jetson-jetpack6:
27
+ type: boolean
28
+ description: Use Dockerfile-jetson-jetpack6
29
+ default: true
30
+ Dockerfile-jetson-jetpack5:
31
+ type: boolean
32
+ description: Use Dockerfile-jetson-jetpack5
33
+ default: true
34
+ Dockerfile-jetson-jetpack4:
35
+ type: boolean
36
+ description: Use Dockerfile-jetson-jetpack4
37
+ default: true
38
+ Dockerfile-python:
39
+ type: boolean
40
+ description: Use Dockerfile-python
41
+ default: true
42
+ Dockerfile-conda:
43
+ type: boolean
44
+ description: Use Dockerfile-conda
45
+ default: true
46
+ push:
47
+ type: boolean
48
+ description: Publish all Images to Docker Hub
49
+
50
+ jobs:
51
+ docker:
52
+ if: github.repository == 'ultralytics/ultralytics'
53
+ name: Push
54
+ runs-on: ubuntu-latest
55
+ strategy:
56
+ fail-fast: false
57
+ max-parallel: 10
58
+ matrix:
59
+ include:
60
+ - dockerfile: "Dockerfile"
61
+ tags: "latest"
62
+ platforms: "linux/amd64"
63
+ - dockerfile: "Dockerfile-cpu"
64
+ tags: "latest-cpu"
65
+ platforms: "linux/amd64"
66
+ - dockerfile: "Dockerfile-arm64"
67
+ tags: "latest-arm64"
68
+ platforms: "linux/arm64"
69
+ - dockerfile: "Dockerfile-jetson-jetpack6"
70
+ tags: "latest-jetson-jetpack6"
71
+ platforms: "linux/arm64"
72
+ - dockerfile: "Dockerfile-jetson-jetpack5"
73
+ tags: "latest-jetson-jetpack5"
74
+ platforms: "linux/arm64"
75
+ - dockerfile: "Dockerfile-jetson-jetpack4"
76
+ tags: "latest-jetson-jetpack4"
77
+ platforms: "linux/arm64"
78
+ - dockerfile: "Dockerfile-python"
79
+ tags: "latest-python"
80
+ platforms: "linux/amd64"
81
+ # - dockerfile: "Dockerfile-conda"
82
+ # tags: "latest-conda"
83
+ # platforms: "linux/amd64"
84
+ steps:
85
+ - name: Cleanup toolcache
86
+ # Free up to 10GB of disk space per https://github.com/ultralytics/ultralytics/pull/14894
87
+ run: |
88
+ echo "Free space before deletion:"
89
+ df -h /
90
+ rm -rf /opt/hostedtoolcache
91
+ echo "Free space after deletion:"
92
+ df -h /
93
+
94
+ - name: Checkout repo
95
+ uses: actions/checkout@v4
96
+ with:
97
+ fetch-depth: 0 # copy full .git directory to access full git history in Docker images
98
+
99
+ - name: Set up QEMU
100
+ uses: docker/setup-qemu-action@v3
101
+
102
+ - name: Set up Docker Buildx
103
+ uses: docker/setup-buildx-action@v3
104
+
105
+ - name: Login to Docker Hub
106
+ uses: docker/login-action@v3
107
+ with:
108
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
109
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
110
+
111
+ - name: Retrieve Ultralytics version
112
+ id: get_version
113
+ run: |
114
+ VERSION=$(grep "^__version__ =" ultralytics/__init__.py | awk -F'"' '{print $2}')
115
+ echo "Retrieved Ultralytics version: $VERSION"
116
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
117
+
118
+ VERSION_TAG=$(echo "${{ matrix.tags }}" | sed "s/latest/${VERSION}/")
119
+ echo "Intended version tag: $VERSION_TAG"
120
+ echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT
121
+
122
+ - name: Check if version tag exists on DockerHub
123
+ id: check_tag
124
+ run: |
125
+ RESPONSE=$(curl -s https://hub.docker.com/v2/repositories/ultralytics/ultralytics/tags/$VERSION_TAG)
126
+ MESSAGE=$(echo $RESPONSE | jq -r '.message')
127
+ if [[ "$MESSAGE" == "null" ]]; then
128
+ echo "Tag $VERSION_TAG already exists on DockerHub."
129
+ echo "exists=true" >> $GITHUB_OUTPUT
130
+ elif [[ "$MESSAGE" == *"404"* ]]; then
131
+ echo "Tag $VERSION_TAG does not exist on DockerHub."
132
+ echo "exists=false" >> $GITHUB_OUTPUT
133
+ else
134
+ echo "Unexpected response from DockerHub. Please check manually."
135
+ echo "exists=false" >> $GITHUB_OUTPUT
136
+ fi
137
+ env:
138
+ VERSION_TAG: ${{ steps.get_version.outputs.version_tag }}
139
+
140
+ - name: Build Image
141
+ if: github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true'
142
+ uses: nick-invision/retry@v3
143
+ with:
144
+ timeout_minutes: 120
145
+ retry_wait_seconds: 60
146
+ max_attempts: 2 # retry once
147
+ command: |
148
+ docker build \
149
+ --platform ${{ matrix.platforms }} \
150
+ -f docker/${{ matrix.dockerfile }} \
151
+ -t ultralytics/ultralytics:${{ matrix.tags }} \
152
+ -t ultralytics/ultralytics:${{ steps.get_version.outputs.version_tag }} \
153
+ .
154
+
155
+ - name: Run Tests
156
+ if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && matrix.platforms == 'linux/amd64' && matrix.dockerfile != 'Dockerfile-conda' # arm64 images not supported on GitHub CI runners
157
+ run: docker run ultralytics/ultralytics:${{ matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
158
+
159
+ - name: Run Benchmarks
160
+ # WARNING: Dockerfile (GPU) error on TF.js export 'module 'numpy' has no attribute 'object'.
161
+ if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && matrix.platforms == 'linux/amd64' && matrix.dockerfile != 'Dockerfile' && matrix.dockerfile != 'Dockerfile-conda' # arm64 images not supported on GitHub CI runners
162
+ run: docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolov8n.pt imgsz=160 verbose=0.318
163
+
164
+ - name: Push Docker Image with Ultralytics version tag
165
+ if: (github.event_name == 'push' || (github.event.inputs[matrix.dockerfile] == 'true' && github.event.inputs.push == 'true')) && steps.check_tag.outputs.exists == 'false' && matrix.dockerfile != 'Dockerfile-conda'
166
+ run: |
167
+ docker push ultralytics/ultralytics:${{ steps.get_version.outputs.version_tag }}
168
+
169
+ - name: Push Docker Image with latest tag
170
+ if: github.event_name == 'push' || (github.event.inputs[matrix.dockerfile] == 'true' && github.event.inputs.push == 'true')
171
+ run: |
172
+ docker push ultralytics/ultralytics:${{ matrix.tags }}
173
+ if [[ "${{ matrix.tags }}" == "latest" ]]; then
174
+ t=ultralytics/ultralytics:latest-runner
175
+ docker build -f docker/Dockerfile-runner -t $t .
176
+ docker push $t
177
+ fi
178
+
179
+ - name: Notify on failure
180
+ if: github.event_name == 'push' && failure() # do not notify on cancelled() as cancelling is performed by hand
181
+ uses: slackapi/slack-github-action@v1.26.0
182
+ with:
183
+ payload: |
184
+ {"text": "<!channel> GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n"}
185
+ env:
186
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }}
ultralytics/.github/workflows/docs.yml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Test and publish docs to https://docs.ultralytics.com
3
+ # Ignores the following Docs rules to match Google-style docstrings:
4
+ # D100: Missing docstring in public module
5
+ # D104: Missing docstring in public package
6
+ # D203: 1 blank line required before class docstring
7
+ # D205: 1 blank line required between summary line and description
8
+ # D212: Multi-line docstring summary should start at the first line
9
+ # D213: Multi-line docstring summary should start at the second line
10
+ # D401: First line of docstring should be in imperative mood
11
+ # D406: Section name should end with a newline
12
+ # D407: Missing dashed underline after section
13
+ # D413: Missing blank line after last section
14
+
15
+ name: Publish Docs
16
+
17
+ on:
18
+ push:
19
+ branches: [main]
20
+ pull_request_target:
21
+ branches: [main]
22
+ workflow_dispatch:
23
+
24
+ jobs:
25
+ Docs:
26
+ if: github.repository == 'ultralytics/ultralytics'
27
+ runs-on: macos-14
28
+ steps:
29
+ - name: Git config
30
+ run: |
31
+ git config --global user.name "UltralyticsAssistant"
32
+ git config --global user.email "web@ultralytics.com"
33
+ - name: Checkout Repository
34
+ uses: actions/checkout@v4
35
+ with:
36
+ repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
37
+ token: ${{ secrets.GITHUB_TOKEN }}
38
+ ref: ${{ github.head_ref || github.ref }}
39
+ fetch-depth: 0
40
+ - name: Set up Python
41
+ uses: actions/setup-python@v5
42
+ with:
43
+ python-version: "3.x"
44
+ cache: "pip" # caching pip dependencies
45
+ - name: Install Dependencies
46
+ run: pip install ruff black tqdm mkdocs-material "mkdocstrings[python]" mkdocs-jupyter mkdocs-redirects mkdocs-ultralytics-plugin mkdocs-macros-plugin
47
+ - name: Ruff fixes
48
+ continue-on-error: true
49
+ run: ruff check --fix --fix-unsafe --select D --ignore=D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 .
50
+ - name: Update Docs Reference Section and Push Changes
51
+ if: github.event_name == 'pull_request_target'
52
+ run: |
53
+ python docs/build_reference.py
54
+ git pull origin ${{ github.head_ref || github.ref }}
55
+ git add .
56
+ git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
57
+ if ! git diff --staged --quiet; then
58
+ git commit -m "Auto-update Ultralytics Docs Reference by https://ultralytics.com/actions"
59
+ git push
60
+ else
61
+ echo "No changes to commit"
62
+ fi
63
+ - name: Ruff checks
64
+ run: ruff check --select D --ignore=D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 .
65
+ - name: Build Docs and Check for Warnings
66
+ run: |
67
+ export JUPYTER_PLATFORM_DIRS=1
68
+ python docs/build_docs.py
69
+ - name: Commit and Push Docs changes
70
+ continue-on-error: true
71
+ if: always() && github.event_name == 'pull_request_target'
72
+ run: |
73
+ git pull origin ${{ github.head_ref || github.ref }}
74
+ git add --update # only add updated files
75
+ git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
76
+ if ! git diff --staged --quiet; then
77
+ git commit -m "Auto-update Ultralytics Docs by https://ultralytics.com/actions"
78
+ git push
79
+ else
80
+ echo "No changes to commit"
81
+ fi
82
+ - name: Publish Docs to https://docs.ultralytics.com
83
+ if: github.event_name == 'push'
84
+ env:
85
+ PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
86
+ INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY_DOCS }}
87
+ run: |
88
+ git clone https://github.com/ultralytics/docs.git docs-repo
89
+ cd docs-repo
90
+ git checkout gh-pages || git checkout -b gh-pages
91
+ rm -rf *
92
+ cp -R ../site/* .
93
+ echo "$INDEXNOW_KEY" > "$INDEXNOW_KEY.txt"
94
+ git add .
95
+ if git diff --staged --quiet; then
96
+ echo "No changes to commit"
97
+ else
98
+ LATEST_HASH=$(git rev-parse --short=7 HEAD)
99
+ git commit -m "Update Docs for 'ultralytics ${{ steps.check_pypi.outputs.version }} - $LATEST_HASH'"
100
+ git push https://$PERSONAL_ACCESS_TOKEN@github.com/ultralytics/docs.git gh-pages
101
+ fi
ultralytics/.github/workflows/format.yml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics 🚀 - AGPL-3.0 License https://ultralytics.com/license
2
+ # Ultralytics Actions https://github.com/ultralytics/actions
3
+ # This workflow automatically formats code and documentation in PRs to official Ultralytics standards
4
+
5
+ name: Ultralytics Actions
6
+
7
+ on:
8
+ issues:
9
+ types: [opened, edited]
10
+ pull_request_target:
11
+ branches: [main]
12
+ types: [opened, closed, synchronize, review_requested]
13
+
14
+ jobs:
15
+ format:
16
+ runs-on: macos-14
17
+ steps:
18
+ - name: Run Ultralytics Formatting
19
+ uses: ultralytics/actions@main
20
+ with:
21
+ token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} # note GITHUB_TOKEN automatically generated
22
+ labels: true # autolabel issues and PRs
23
+ python: true # format Python code and docstrings
24
+ prettier: true # format YAML, JSON, Markdown and CSS
25
+ spelling: true # check spelling
26
+ links: false # check broken links
27
+ summary: true # print PR summary with GPT4o (requires 'openai_api_key')
28
+ openai_azure_api_key: ${{ secrets.OPENAI_AZURE_API_KEY }}
29
+ openai_azure_endpoint: ${{ secrets.OPENAI_AZURE_ENDPOINT }}
ultralytics/.github/workflows/greetings.yml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: Greetings
4
+
5
+ on:
6
+ pull_request_target:
7
+ types: [opened]
8
+ issues:
9
+ types: [opened]
10
+
11
+ jobs:
12
+ greeting:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/first-interaction@v1
16
+ with:
17
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
18
+ pr-message: |
19
+ 👋 Hello @${{ github.actor }}, thank you for submitting an Ultralytics YOLOv8 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
20
+
21
+ - ✅ Verify your PR is **up-to-date** with `ultralytics/ultralytics` `main` branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by running `git pull` and `git merge main` locally.
22
+ - ✅ Verify all YOLOv8 Continuous Integration (CI) **checks are passing**.
23
+ - ✅ Update YOLOv8 [Docs](https://docs.ultralytics.com) for any new or updated features.
24
+ - ✅ Reduce changes to the absolute **minimum** required for your bug fix or feature addition. _"It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is."_ — Bruce Lee
25
+
26
+ See our [Contributing Guide](https://docs.ultralytics.com/help/contributing) for details and let us know if you have any questions!
27
+
28
+ issue-message: |
29
+ 👋 Hello @${{ github.actor }}, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the [Docs](https://docs.ultralytics.com) for new users where you can find many [Python](https://docs.ultralytics.com/usage/python/) and [CLI](https://docs.ultralytics.com/usage/cli/) usage examples and where many of the most common questions may already be answered.
30
+
31
+ If this is a 🐛 Bug Report, please provide a [minimum reproducible example](https://docs.ultralytics.com/help/minimum_reproducible_example/) to help us debug it.
32
+
33
+ If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our [Tips for Best Training Results](https://docs.ultralytics.com/guides/model-training-tips//).
34
+
35
+ Join the vibrant [Ultralytics Discord](https://ultralytics.com/discord) 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
36
+
37
+ ## Install
38
+
39
+ Pip install the `ultralytics` package including all [requirements](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) in a [**Python>=3.8**](https://www.python.org/) environment with [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/).
40
+
41
+ ```bash
42
+ pip install ultralytics
43
+ ```
44
+
45
+ ## Environments
46
+
47
+ YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including [CUDA](https://developer.nvidia.com/cuda)/[CUDNN](https://developer.nvidia.com/cudnn), [Python](https://www.python.org/) and [PyTorch](https://pytorch.org/) preinstalled):
48
+
49
+ - **Notebooks** with free GPU: <a href="https://console.paperspace.com/github/ultralytics/ultralytics"><img src="https://assets.paperspace.io/img/gradient-badge.svg" alt="Run on Gradient"/></a> <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> <a href="https://www.kaggle.com/ultralytics/yolov8"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
50
+ - **Google Cloud** Deep Learning VM. See [GCP Quickstart Guide](https://docs.ultralytics.com/yolov5/environments/google_cloud_quickstart_tutorial/)
51
+ - **Amazon** Deep Learning AMI. See [AWS Quickstart Guide](https://docs.ultralytics.com/yolov5/environments/aws_quickstart_tutorial/)
52
+ - **Docker Image**. See [Docker Quickstart Guide](https://docs.ultralytics.com/yolov5/environments/docker_image_quickstart_tutorial/) <a href="https://hub.docker.com/r/ultralytics/ultralytics"><img src="https://img.shields.io/docker/pulls/ultralytics/ultralytics?logo=docker" alt="Docker Pulls"></a>
53
+
54
+ ## Status
55
+
56
+ <a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml?query=event%3Aschedule"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml/badge.svg" alt="Ultralytics CI"></a>
57
+
58
+ If this badge is green, all [Ultralytics CI](https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml?query=event%3Aschedule) tests are currently passing. CI tests verify correct operation of all YOLOv8 [Modes](https://docs.ultralytics.com/modes/) and [Tasks](https://docs.ultralytics.com/tasks/) on macOS, Windows, and Ubuntu every 24 hours and on every commit.
ultralytics/.github/workflows/links.yml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Continuous Integration (CI) GitHub Actions tests broken link checker using https://github.com/lycheeverse/lychee
3
+ # Ignores the following status codes to reduce false positives:
4
+ # - 401(Vimeo, 'unauthorized')
5
+ # - 403(OpenVINO, 'forbidden')
6
+ # - 429(Instagram, 'too many requests')
7
+ # - 500(Zenodo, 'cached')
8
+ # - 502(Zenodo, 'bad gateway')
9
+ # - 999(LinkedIn, 'unknown status code')
10
+
11
+ name: Check Broken links
12
+
13
+ on:
14
+ workflow_dispatch:
15
+ schedule:
16
+ - cron: "0 0 * * *" # runs at 00:00 UTC every day
17
+
18
+ jobs:
19
+ Links:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Download and install lychee
25
+ run: |
26
+ LYCHEE_URL=$(curl -s https://api.github.com/repos/lycheeverse/lychee/releases/latest | grep "browser_download_url" | grep "x86_64-unknown-linux-gnu.tar.gz" | cut -d '"' -f 4)
27
+ curl -L $LYCHEE_URL -o lychee.tar.gz
28
+ tar xzf lychee.tar.gz
29
+ sudo mv lychee /usr/local/bin
30
+
31
+ - name: Test Markdown and HTML links with retry
32
+ uses: nick-invision/retry@v3
33
+ with:
34
+ timeout_minutes: 5
35
+ retry_wait_seconds: 60
36
+ max_attempts: 3
37
+ command: |
38
+ lychee \
39
+ --scheme https \
40
+ --timeout 60 \
41
+ --insecure \
42
+ --accept 401,403,429,500,502,999 \
43
+ --exclude-all-private \
44
+ --exclude 'https?://(www\.)?(linkedin\.com|twitter\.com|instagram\.com|kaggle\.com|fonts\.gstatic\.com|url\.com)' \
45
+ --exclude-path docs/zh \
46
+ --exclude-path docs/es \
47
+ --exclude-path docs/ru \
48
+ --exclude-path docs/pt \
49
+ --exclude-path docs/fr \
50
+ --exclude-path docs/de \
51
+ --exclude-path docs/ja \
52
+ --exclude-path docs/ko \
53
+ --exclude-path docs/hi \
54
+ --exclude-path docs/ar \
55
+ --github-token ${{ secrets.GITHUB_TOKEN }} \
56
+ --header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.183 Safari/537.36" \
57
+ './**/*.md' \
58
+ './**/*.html'
59
+
60
+ - name: Test Markdown, HTML, YAML, Python and Notebook links with retry
61
+ if: github.event_name == 'workflow_dispatch'
62
+ uses: nick-invision/retry@v3
63
+ with:
64
+ timeout_minutes: 5
65
+ retry_wait_seconds: 60
66
+ max_attempts: 3
67
+ command: |
68
+ lychee \
69
+ --scheme https \
70
+ --timeout 60 \
71
+ --insecure \
72
+ --accept 401,403,429,500,502,999 \
73
+ --exclude-all-private \
74
+ --exclude 'https?://(www\.)?(linkedin\.com|twitter\.com|instagram\.com|kaggle\.com|fonts\.gstatic\.com|url\.com)' \
75
+ --exclude-path '**/ci.yaml' \
76
+ --exclude-path docs/zh \
77
+ --exclude-path docs/es \
78
+ --exclude-path docs/ru \
79
+ --exclude-path docs/pt \
80
+ --exclude-path docs/fr \
81
+ --exclude-path docs/de \
82
+ --exclude-path docs/ja \
83
+ --exclude-path docs/ko \
84
+ --exclude-path docs/hi \
85
+ --exclude-path docs/ar \
86
+ --github-token ${{ secrets.GITHUB_TOKEN }} \
87
+ --header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.183 Safari/537.36" \
88
+ './**/*.md' \
89
+ './**/*.html' \
90
+ './**/*.yml' \
91
+ './**/*.yaml' \
92
+ './**/*.py' \
93
+ './**/*.ipynb'
ultralytics/.github/workflows/merge-main-into-prs.yml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Automatically merges repository 'main' branch into all open PRs to keep them up-to-date
3
+ # Action runs on updates to main branch so when one PR merges to main all others update
4
+
5
+ name: Merge main into PRs
6
+
7
+ on:
8
+ workflow_dispatch:
9
+ # push:
10
+ # branches:
11
+ # - ${{ github.event.repository.default_branch }}
12
+
13
+ jobs:
14
+ Merge:
15
+ if: github.repository == 'ultralytics/ultralytics'
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.x"
25
+ cache: "pip"
26
+ - name: Install requirements
27
+ run: |
28
+ pip install pygithub
29
+ - name: Merge default branch into PRs
30
+ shell: python
31
+ run: |
32
+ from github import Github
33
+ import os
34
+ import time
35
+
36
+ g = Github(os.getenv('GITHUB_TOKEN'))
37
+ repo = g.get_repo(os.getenv('GITHUB_REPOSITORY'))
38
+
39
+ # Fetch the default branch name
40
+ default_branch_name = repo.default_branch
41
+ default_branch = repo.get_branch(default_branch_name)
42
+
43
+ # Initialize counters
44
+ updated_branches = 0
45
+ up_to_date_branches = 0
46
+ errors = 0
47
+
48
+ for pr in repo.get_pulls(state='open', sort='created'):
49
+ try:
50
+ # Label PRs as popular for positive reactions
51
+ reactions = pr.as_issue().get_reactions()
52
+ if sum([(1 if r.content not in {"-1", "confused"} else 0) for r in reactions]) > 5:
53
+ pr.set_labels(*("popular",) + tuple(l.name for l in pr.get_labels()))
54
+
55
+ # Get full names for repositories and branches
56
+ base_repo_name = repo.full_name
57
+ head_repo_name = pr.head.repo.full_name
58
+ base_branch_name = pr.base.ref
59
+ head_branch_name = pr.head.ref
60
+
61
+ # Check if PR is behind the default branch
62
+ comparison = repo.compare(default_branch.commit.sha, pr.head.sha)
63
+ if comparison.behind_by > 0:
64
+ print(f"⚠️ PR #{pr.number} ({head_repo_name}:{head_branch_name} -> {base_repo_name}:{base_branch_name}) is behind {default_branch_name} by {comparison.behind_by} commit(s).")
65
+
66
+ # Attempt to update the branch
67
+ try:
68
+ success = pr.update_branch()
69
+ assert success, "Branch update failed"
70
+ print(f"✅ Successfully merged '{default_branch_name}' into PR #{pr.number} ({head_repo_name}:{head_branch_name} -> {base_repo_name}:{base_branch_name}).")
71
+ updated_branches += 1
72
+ time.sleep(10) # rate limit merges
73
+ except Exception as update_error:
74
+ print(f"❌ Could not update PR #{pr.number} ({head_repo_name}:{head_branch_name} -> {base_repo_name}:{base_branch_name}): {update_error}")
75
+ errors += 1
76
+ else:
77
+ print(f"✅ PR #{pr.number} ({head_repo_name}:{head_branch_name} -> {base_repo_name}:{base_branch_name}) is already up to date with {default_branch_name}, no merge required.")
78
+ up_to_date_branches += 1
79
+ except Exception as e:
80
+ print(f"❌ Could not process PR #{pr.number}: {e}")
81
+ errors += 1
82
+
83
+ # Print summary
84
+ print("\n\nSummary:")
85
+ print(f"Branches updated: {updated_branches}")
86
+ print(f"Branches already up-to-date: {up_to_date_branches}")
87
+ print(f"Total errors: {errors}")
88
+
89
+ env:
90
+ GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
91
+ GITHUB_REPOSITORY: ${{ github.repository }}
ultralytics/.github/workflows/publish.yml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Publish pip package to PyPI https://pypi.org/project/ultralytics/
3
+
4
+ name: Publish to PyPI
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+ inputs:
11
+ pypi:
12
+ type: boolean
13
+ description: Publish to PyPI
14
+
15
+ jobs:
16
+ publish:
17
+ if: github.repository == 'ultralytics/ultralytics' && github.actor == 'glenn-jocher'
18
+ name: Publish
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+ with:
24
+ token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} # use your PAT here
25
+ - name: Git config
26
+ run: |
27
+ git config --global user.name "UltralyticsAssistant"
28
+ git config --global user.email "web@ultralytics.com"
29
+ - name: Set up Python environment
30
+ uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.x"
33
+ cache: "pip" # caching pip dependencies
34
+ - name: Install dependencies
35
+ run: |
36
+ python -m pip install --upgrade pip wheel
37
+ pip install openai requests build twine toml
38
+ - name: Check PyPI version
39
+ shell: python
40
+ run: |
41
+ import os
42
+ import requests
43
+ import toml
44
+
45
+ # Load version and package name from pyproject.toml
46
+ pyproject = toml.load('pyproject.toml')
47
+ package_name = pyproject['project']['name']
48
+ local_version = pyproject['project'].get('version', 'dynamic')
49
+
50
+ # If version is dynamic, extract it from the specified file
51
+ if local_version == 'dynamic':
52
+ version_attr = pyproject['tool']['setuptools']['dynamic']['version']['attr']
53
+ module_path, attr_name = version_attr.rsplit('.', 1)
54
+ with open(f"{module_path.replace('.', '/')}/__init__.py") as f:
55
+ local_version = next(line.split('=')[1].strip().strip("'\"") for line in f if line.startswith(attr_name))
56
+
57
+ print(f"Local Version: {local_version}")
58
+
59
+ # Get online version from PyPI
60
+ response = requests.get(f"https://pypi.org/pypi/{package_name}/json")
61
+ online_version = response.json()['info']['version'] if response.status_code == 200 else None
62
+ print(f"Online Version: {online_version or 'Not Found'}")
63
+
64
+ # Determine if a new version should be published
65
+ publish = False
66
+ if online_version:
67
+ local_ver = tuple(map(int, local_version.split('.')))
68
+ online_ver = tuple(map(int, online_version.split('.')))
69
+ major_diff = local_ver[0] - online_ver[0]
70
+ minor_diff = local_ver[1] - online_ver[1]
71
+ patch_diff = local_ver[2] - online_ver[2]
72
+
73
+ publish = (
74
+ (major_diff == 0 and minor_diff == 0 and 0 < patch_diff <= 2) or
75
+ (major_diff == 0 and minor_diff == 1 and local_ver[2] == 0) or
76
+ (major_diff == 1 and local_ver[1] == 0 and local_ver[2] == 0)
77
+ )
78
+ else:
79
+ publish = True # First release
80
+
81
+ os.system(f'echo "increment={publish}" >> $GITHUB_OUTPUT')
82
+ os.system(f'echo "version={local_version}" >> $GITHUB_OUTPUT')
83
+ os.system(f'echo "previous_version={online_version or "N/A"}" >> $GITHUB_OUTPUT')
84
+
85
+ if publish:
86
+ print('Ready to publish new version to PyPI ✅.')
87
+ id: check_pypi
88
+ - name: Publish new tag
89
+ if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True'
90
+ run: |
91
+ git tag -a "v${{ steps.check_pypi.outputs.version }}" -m "$(git log -1 --pretty=%B)" # i.e. "v0.1.2 commit message"
92
+ git push origin "v${{ steps.check_pypi.outputs.version }}"
93
+ - name: Publish new release
94
+ if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True'
95
+ env:
96
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
97
+ GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
98
+ CURRENT_TAG: ${{ steps.check_pypi.outputs.version }}
99
+ PREVIOUS_TAG: ${{ steps.check_pypi.outputs.previous_version }}
100
+ shell: python
101
+ run: |
102
+ import openai
103
+ import os
104
+ import requests
105
+ import json
106
+ import subprocess
107
+
108
+ # Retrieve environment variables
109
+ OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
110
+ GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
111
+ CURRENT_TAG = os.getenv('CURRENT_TAG')
112
+ PREVIOUS_TAG = os.getenv('PREVIOUS_TAG')
113
+
114
+ # Check for required environment variables
115
+ if not all([OPENAI_API_KEY, GITHUB_TOKEN, CURRENT_TAG, PREVIOUS_TAG]):
116
+ raise ValueError("One or more required environment variables are missing.")
117
+
118
+ latest_tag = f"v{CURRENT_TAG}"
119
+ previous_tag = f"v{PREVIOUS_TAG}"
120
+ repo = os.getenv('GITHUB_REPOSITORY')
121
+ headers = {"Authorization": f"token {GITHUB_TOKEN}", "Accept": "application/vnd.github.v3.diff"}
122
+
123
+ # Get the diff between the tags
124
+ url = f"https://api.github.com/repos/{repo}/compare/{previous_tag}...{latest_tag}"
125
+ response = requests.get(url, headers=headers)
126
+ diff = response.text if response.status_code == 200 else f"Failed to get diff: {response.content}"
127
+
128
+ # Get summary
129
+ messages = [
130
+ {
131
+ "role": "system",
132
+ "content": "You are an Ultralytics AI assistant skilled in software development and technical communication. Your task is to summarize GitHub releases in a way that is detailed, accurate, and understandable to both expert developers and non-expert users. Focus on highlighting the key changes and their impact in simple and intuitive terms."
133
+ },
134
+ {
135
+ "role": "user",
136
+ "content": f"Summarize the updates made in the '{latest_tag}' tag, focusing on major changes, their purpose, and potential impact. Keep the summary clear and suitable for a broad audience. Add emojis to enliven the summary. Reply directly with a summary along these example guidelines, though feel free to adjust as appropriate:\n\n"
137
+ f"## 🌟 Summary (single-line synopsis)\n"
138
+ f"## 📊 Key Changes (bullet points highlighting any major changes)\n"
139
+ f"## 🎯 Purpose & Impact (bullet points explaining any benefits and potential impact to users)\n"
140
+ f"\n\nHere's the release diff:\n\n{diff[:300000]}",
141
+ }
142
+ ]
143
+ client = openai.OpenAI(api_key=OPENAI_API_KEY)
144
+ completion = client.chat.completions.create(model="gpt-4o-2024-08-06", messages=messages)
145
+ summary = completion.choices[0].message.content.strip()
146
+
147
+ # Get the latest commit message
148
+ commit_message = subprocess.run(['git', 'log', '-1', '--pretty=%B'], check=True, text=True, capture_output=True).stdout.split("\n")[0].strip()
149
+
150
+ # Prepare release data
151
+ release = {
152
+ 'tag_name': latest_tag,
153
+ 'name': f"{latest_tag} - {commit_message}",
154
+ 'body': summary,
155
+ 'draft': False,
156
+ 'prerelease': False
157
+ }
158
+
159
+ # Create the release on GitHub
160
+ release_url = f"https://api.github.com/repos/{repo}/releases"
161
+ release_response = requests.post(release_url, headers=headers, data=json.dumps(release))
162
+ if release_response.status_code == 201:
163
+ print(f'Successfully created release {latest_tag}')
164
+ else:
165
+ print(f'Failed to create release {latest_tag}: {release_response.content}')
166
+ - name: Publish to PyPI
167
+ continue-on-error: true
168
+ if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True'
169
+ env:
170
+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
171
+ run: |
172
+ python -m build
173
+ python -m twine upload dist/* -u __token__ -p $PYPI_TOKEN
174
+ - name: Extract PR Details
175
+ env:
176
+ GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
177
+ run: |
178
+ # Check if the event is a pull request or pull_request_target
179
+ if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then
180
+ PR_NUMBER=${{ github.event.pull_request.number }}
181
+ PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title')
182
+ else
183
+ # Use gh to find the PR associated with the commit
184
+ COMMIT_SHA=${{ github.event.after }}
185
+ PR_JSON=$(gh pr list --search "${COMMIT_SHA}" --state merged --json number,title --jq '.[0]')
186
+ PR_NUMBER=$(echo $PR_JSON | jq -r '.number')
187
+ PR_TITLE=$(echo $PR_JSON | jq -r '.title')
188
+ fi
189
+ echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
190
+ echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
191
+ - name: Notify on Slack (Success)
192
+ if: success() && github.event_name == 'push' && steps.check_pypi.outputs.increment == 'True'
193
+ uses: slackapi/slack-github-action@v1.26.0
194
+ with:
195
+ payload: |
196
+ {"text": "<!channel> GitHub Actions success for ${{ github.workflow }} ✅\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* NEW '${{ github.repository }} v${{ steps.check_pypi.outputs.version }}' pip package published 😃\n*Job Status:* ${{ job.status }}\n*Pull Request:* <https://github.com/${{ github.repository }}/pull/${{ env.PR_NUMBER }}> ${{ env.PR_TITLE }}\n"}
197
+ env:
198
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }}
199
+ - name: Notify on Slack (Failure)
200
+ if: failure()
201
+ uses: slackapi/slack-github-action@v1.26.0
202
+ with:
203
+ payload: |
204
+ {"text": "<!channel> GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n*Job Status:* ${{ job.status }}\n*Pull Request:* <https://github.com/${{ github.repository }}/pull/${{ env.PR_NUMBER }}> ${{ env.PR_TITLE }}\n"}
205
+ env:
206
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }}
ultralytics/.github/workflows/stale.yml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+ name: Close stale issues
4
+ on:
5
+ schedule:
6
+ - cron: "0 0 * * *" # Runs at 00:00 UTC every day
7
+
8
+ jobs:
9
+ stale:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/stale@v9
13
+ with:
14
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
15
+
16
+ stale-issue-message: |
17
+ 👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
18
+
19
+ For additional resources and information, please see the links below:
20
+
21
+ - **Docs**: https://docs.ultralytics.com
22
+ - **HUB**: https://hub.ultralytics.com
23
+ - **Community**: https://community.ultralytics.com
24
+
25
+ Feel free to inform us of any other **issues** you discover or **feature requests** that come to mind in the future. Pull Requests (PRs) are also always welcomed!
26
+
27
+ Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
28
+
29
+ stale-pr-message: |
30
+ 👋 Hello there! We wanted to let you know that we've decided to close this pull request due to inactivity. We appreciate the effort you put into contributing to our project, but unfortunately, not all contributions are suitable or aligned with our product roadmap.
31
+
32
+ We hope you understand our decision, and please don't let it discourage you from contributing to open source projects in the future. We value all of our community members and their contributions, and we encourage you to keep exploring new projects and ways to get involved.
33
+
34
+ For additional resources and information, please see the links below:
35
+
36
+ - **Docs**: https://docs.ultralytics.com
37
+ - **HUB**: https://hub.ultralytics.com
38
+ - **Community**: https://community.ultralytics.com
39
+
40
+ Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
41
+
42
+ days-before-issue-stale: 30
43
+ days-before-issue-close: 10
44
+ days-before-pr-stale: 90
45
+ days-before-pr-close: 30
46
+ exempt-issue-labels: "documentation,tutorial,TODO"
47
+ operations-per-run: 300 # The maximum number of operations per run, used to control rate limiting.
ultralytics/.gitignore ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+ requirements.txt
30
+ setup.py
31
+ ultralytics.egg-info
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other info into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ mlruns/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # Profiling
89
+ *.pclprof
90
+
91
+ # pyenv
92
+ .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
102
+ __pypackages__/
103
+
104
+ # Celery stuff
105
+ celerybeat-schedule
106
+ celerybeat.pid
107
+
108
+ # SageMath parsed files
109
+ *.sage.py
110
+
111
+ # Environments
112
+ .env
113
+ .venv
114
+ .idea
115
+ env/
116
+ venv/
117
+ ENV/
118
+ env.bak/
119
+ venv.bak/
120
+
121
+ # Spyder project settings
122
+ .spyderproject
123
+ .spyproject
124
+
125
+ # VSCode project settings
126
+ .vscode/
127
+
128
+ # Rope project settings
129
+ .ropeproject
130
+
131
+ # mkdocs documentation
132
+ /site
133
+ mkdocs_github_authors.yaml
134
+
135
+ # mypy
136
+ .mypy_cache/
137
+ .dmypy.json
138
+ dmypy.json
139
+
140
+ # Pyre type checker
141
+ .pyre/
142
+
143
+ # datasets and projects
144
+ datasets/
145
+ runs/
146
+ wandb/
147
+ .DS_Store
148
+
149
+ # Neural Network weights -----------------------------------------------------------------------------------------------
150
+ weights/
151
+ *.weights
152
+ *.pt
153
+ *.pb
154
+ *.onnx
155
+ *.engine
156
+ *.mlmodel
157
+ *.mlpackage
158
+ *.torchscript
159
+ *.tflite
160
+ *.h5
161
+ *_saved_model/
162
+ *_web_model/
163
+ *_openvino_model/
164
+ *_paddle_model/
165
+ *_ncnn_model/
166
+ pnnx*
167
+
168
+ # Autogenerated files for tests
169
+ /ultralytics/assets/
170
+
171
+ # calibration image
172
+ calibration_*.npy
ultralytics/CITATION.cff ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This CITATION.cff file was generated with https://bit.ly/cffinit
2
+
3
+ cff-version: 1.2.0
4
+ title: Ultralytics YOLO
5
+ message: >-
6
+ If you use this software, please cite it using the
7
+ metadata from this file.
8
+ type: software
9
+ authors:
10
+ - given-names: Glenn
11
+ family-names: Jocher
12
+ affiliation: Ultralytics
13
+ orcid: 'https://orcid.org/0000-0001-5950-6979'
14
+ - given-names: Ayush
15
+ family-names: Chaurasia
16
+ affiliation: Ultralytics
17
+ orcid: 'https://orcid.org/0000-0002-7603-6750'
18
+ - family-names: Qiu
19
+ given-names: Jing
20
+ affiliation: Ultralytics
21
+ orcid: 'https://orcid.org/0000-0003-3783-7069'
22
+ repository-code: 'https://github.com/ultralytics/ultralytics'
23
+ url: 'https://ultralytics.com'
24
+ license: AGPL-3.0
25
+ version: 8.0.0
26
+ date-released: '2023-01-10'
ultralytics/CONTRIBUTING.md ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ comments: true
3
+ description: Learn how to contribute to Ultralytics YOLO open-source repositories. Follow guidelines for pull requests, code of conduct, and bug reporting.
4
+ keywords: Ultralytics, YOLO, open-source, contribution, pull request, code of conduct, bug reporting, GitHub, CLA, Google-style docstrings
5
+ ---
6
+
7
+ # Contributing to Ultralytics Open-Source Projects
8
+
9
+ Welcome! We're thrilled that you're considering contributing to our [Ultralytics](https://ultralytics.com) [open-source](https://github.com/ultralytics) projects. Your involvement not only helps enhance the quality of our repositories but also benefits the entire community. This guide provides clear guidelines and best practices to help you get started.
10
+
11
+ <a href="https://github.com/ultralytics/ultralytics/graphs/contributors">
12
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/image-contributors.png" alt="Ultralytics open-source contributors"></a>
13
+
14
+ ## Table of Contents
15
+
16
+ 1. [Code of Conduct](#code-of-conduct)
17
+ 2. [Contributing via Pull Requests](#contributing-via-pull-requests)
18
+ - [CLA Signing](#cla-signing)
19
+ - [Google-Style Docstrings](#google-style-docstrings)
20
+ - [GitHub Actions CI Tests](#github-actions-ci-tests)
21
+ 3. [Reporting Bugs](#reporting-bugs)
22
+ 4. [License](#license)
23
+ 5. [Conclusion](#conclusion)
24
+ 6. [FAQ](#faq)
25
+
26
+ ## Code of Conduct
27
+
28
+ To ensure a welcoming and inclusive environment for everyone, all contributors must adhere to our [Code of Conduct](https://docs.ultralytics.com/help/code_of_conduct). Respect, kindness, and professionalism are at the heart of our community.
29
+
30
+ ## Contributing via Pull Requests
31
+
32
+ We greatly appreciate contributions in the form of pull requests. To make the review process as smooth as possible, please follow these steps:
33
+
34
+ 1. **[Fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo):** Start by forking the Ultralytics YOLO repository to your GitHub account.
35
+
36
+ 2. **[Create a branch](https://docs.github.com/en/desktop/making-changes-in-a-branch/managing-branches-in-github-desktop):** Create a new branch in your forked repository with a clear, descriptive name that reflects your changes.
37
+
38
+ 3. **Make your changes:** Ensure your code adheres to the project's style guidelines and does not introduce any new errors or warnings.
39
+
40
+ 4. **[Test your changes](https://github.com/ultralytics/ultralytics/tree/main/tests):** Before submitting, test your changes locally to confirm they work as expected and don't cause any new issues.
41
+
42
+ 5. **[Commit your changes](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop):** Commit your changes with a concise and descriptive commit message. If your changes address a specific issue, include the issue number in your commit message.
43
+
44
+ 6. **[Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request):** Submit a pull request from your forked repository to the main Ultralytics YOLO repository. Provide a clear and detailed explanation of your changes and how they improve the project.
45
+
46
+ ### CLA Signing
47
+
48
+ Before we can merge your pull request, you must sign our [Contributor License Agreement (CLA)](https://docs.ultralytics.com/help/CLA). This legal agreement ensures that your contributions are properly licensed, allowing the project to continue being distributed under the AGPL-3.0 license.
49
+
50
+ After submitting your pull request, the CLA bot will guide you through the signing process. To sign the CLA, simply add a comment in your PR stating:
51
+
52
+ ```
53
+ I have read the CLA Document and I sign the CLA
54
+ ```
55
+
56
+ ### Google-Style Docstrings
57
+
58
+ When adding new functions or classes, please include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html). These docstrings provide clear, standardized documentation that helps other developers understand and maintain your code.
59
+
60
+ #### Example
61
+
62
+ This example illustrates a Google-style docstring. Ensure that both input and output `types` are always enclosed in parentheses, e.g., `(bool)`.
63
+
64
+ ```python
65
+ def example_function(arg1, arg2=4):
66
+ """
67
+ Example function demonstrating Google-style docstrings.
68
+
69
+ Args:
70
+ arg1 (int): The first argument.
71
+ arg2 (int): The second argument, with a default value of 4.
72
+
73
+ Returns:
74
+ (bool): True if successful, False otherwise.
75
+
76
+ Examples:
77
+ >>> result = example_function(1, 2) # returns False
78
+ """
79
+ if arg1 == arg2:
80
+ return True
81
+ return False
82
+ ```
83
+
84
+ #### Example with type hints
85
+
86
+ This example includes both a Google-style docstring and type hints for arguments and returns, though using either independently is also acceptable.
87
+
88
+ ```python
89
+ def example_function(arg1: int, arg2: int = 4) -> bool:
90
+ """
91
+ Example function demonstrating Google-style docstrings.
92
+
93
+ Args:
94
+ arg1: The first argument.
95
+ arg2: The second argument, with a default value of 4.
96
+
97
+ Returns:
98
+ True if successful, False otherwise.
99
+
100
+ Examples:
101
+ >>> result = example_function(1, 2) # returns False
102
+ """
103
+ if arg1 == arg2:
104
+ return True
105
+ return False
106
+ ```
107
+
108
+ #### Example Single-line
109
+
110
+ For smaller or simpler functions, a single-line docstring may be sufficient. The docstring must use three double-quotes, be a complete sentence, start with a capital letter, and end with a period.
111
+
112
+ ```python
113
+ def example_small_function(arg1: int, arg2: int = 4) -> bool:
114
+ """Example function with a single-line docstring."""
115
+ return arg1 == arg2
116
+ ```
117
+
118
+ ### GitHub Actions CI Tests
119
+
120
+ All pull requests must pass the GitHub Actions [Continuous Integration](https://docs.ultralytics.com/help/CI) (CI) tests before they can be merged. These tests include linting, unit tests, and other checks to ensure that your changes meet the project's quality standards. Review the CI output and address any issues that arise.
121
+
122
+ ## Reporting Bugs
123
+
124
+ We highly value bug reports as they help us maintain the quality of our projects. When reporting a bug, please provide a [Minimum Reproducible Example](https://docs.ultralytics.com/help/minimum_reproducible_example)—a simple, clear code example that consistently reproduces the issue. This allows us to quickly identify and resolve the problem.
125
+
126
+ ## License
127
+
128
+ Ultralytics uses the [GNU Affero General Public License v3.0 (AGPL-3.0)](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) for its repositories. This license promotes openness, transparency, and collaborative improvement in software development. It ensures that all users have the freedom to use, modify, and share the software, fostering a strong community of collaboration and innovation.
129
+
130
+ We encourage all contributors to familiarize themselves with the terms of the AGPL-3.0 license to contribute effectively and ethically to the Ultralytics open-source community.
131
+
132
+ ## Conclusion
133
+
134
+ Thank you for your interest in contributing to [Ultralytics](https://ultralytics.com) [open-source](https://github.com/ultralytics) YOLO projects. Your participation is essential in shaping the future of our software and building a vibrant community of innovation and collaboration. Whether you're enhancing code, reporting bugs, or suggesting new features, your contributions are invaluable.
135
+
136
+ We're excited to see your ideas come to life and appreciate your commitment to advancing object detection technology. Together, let's continue to grow and innovate in this exciting open-source journey. Happy coding! 🚀🌟
137
+
138
+ ## FAQ
139
+
140
+ ### Why should I contribute to Ultralytics YOLO open-source repositories?
141
+
142
+ Contributing to Ultralytics YOLO open-source repositories improves the software, making it more robust and feature-rich for the entire community. Contributions can include code enhancements, bug fixes, documentation improvements, and new feature implementations. Additionally, contributing allows you to collaborate with other skilled developers and experts in the field, enhancing your own skills and reputation. For details on how to get started, refer to the [Contributing via Pull Requests](#contributing-via-pull-requests) section.
143
+
144
+ ### How do I sign the Contributor License Agreement (CLA) for Ultralytics YOLO?
145
+
146
+ To sign the Contributor License Agreement (CLA), follow the instructions provided by the CLA bot after submitting your pull request. This process ensures that your contributions are properly licensed under the AGPL-3.0 license, maintaining the legal integrity of the open-source project. Add a comment in your pull request stating:
147
+
148
+ ```
149
+ I have read the CLA Document and I sign the CLA.
150
+ ```
151
+
152
+ For more information, see the [CLA Signing](#cla-signing) section.
153
+
154
+ ### What are Google-style docstrings, and why are they required for Ultralytics YOLO contributions?
155
+
156
+ Google-style docstrings provide clear, concise documentation for functions and classes, improving code readability and maintainability. These docstrings outline the function's purpose, arguments, and return values with specific formatting rules. When contributing to Ultralytics YOLO, following Google-style docstrings ensures that your additions are well-documented and easily understood. For examples and guidelines, visit the [Google-Style Docstrings](#google-style-docstrings) section.
157
+
158
+ ### How can I ensure my changes pass the GitHub Actions CI tests?
159
+
160
+ Before your pull request can be merged, it must pass all GitHub Actions Continuous Integration (CI) tests. These tests include linting, unit tests, and other checks to ensure the code meets
161
+
162
+ the project's quality standards. Review the CI output and fix any issues. For detailed information on the CI process and troubleshooting tips, see the [GitHub Actions CI Tests](#github-actions-ci-tests) section.
163
+
164
+ ### How do I report a bug in Ultralytics YOLO repositories?
165
+
166
+ To report a bug, provide a clear and concise [Minimum Reproducible Example](https://docs.ultralytics.com/help/minimum_reproducible_example) along with your bug report. This helps developers quickly identify and fix the issue. Ensure your example is minimal yet sufficient to replicate the problem. For more detailed steps on reporting bugs, refer to the [Reporting Bugs](#reporting-bugs) section.
ultralytics/LICENSE ADDED
@@ -0,0 +1,661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
13
+
14
+ The licenses for most software and other practical works are designed
15
+ to take away your freedom to share and change the works. By contrast,
16
+ our General Public Licenses are intended to guarantee your freedom to
17
+ share and change all versions of a program--to make sure it remains free
18
+ software for all its users.
19
+
20
+ When we speak of free software, we are referring to freedom, not
21
+ price. Our General Public Licenses are designed to make sure that you
22
+ have the freedom to distribute copies of free software (and charge for
23
+ them if you wish), that you receive source code or can get it if you
24
+ want it, that you can change the software or use pieces of it in new
25
+ free programs, and that you know you can do these things.
26
+
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ TERMS AND CONDITIONS
60
+
61
+ 0. Definitions.
62
+
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
64
+
65
+ "Copyright" also means copyright-like laws that apply to other kinds of
66
+ works, such as semiconductor masks.
67
+
68
+ "The Program" refers to any copyrightable work licensed under this
69
+ License. Each licensee is addressed as "you". "Licensees" and
70
+ "recipients" may be individuals or organizations.
71
+
72
+ To "modify" a work means to copy from or adapt all or part of the work
73
+ in a fashion requiring copyright permission, other than the making of an
74
+ exact copy. The resulting work is called a "modified version" of the
75
+ earlier work or a work "based on" the earlier work.
76
+
77
+ A "covered work" means either the unmodified Program or a work based
78
+ on the Program.
79
+
80
+ To "propagate" a work means to do anything with it that, without
81
+ permission, would make you directly or secondarily liable for
82
+ infringement under applicable copyright law, except executing it on a
83
+ computer or modifying a private copy. Propagation includes copying,
84
+ distribution (with or without modification), making available to the
85
+ public, and in some countries other activities as well.
86
+
87
+ To "convey" a work means any kind of propagation that enables other
88
+ parties to make or receive copies. Mere interaction with a user through
89
+ a computer network, with no transfer of a copy, is not conveying.
90
+
91
+ An interactive user interface displays "Appropriate Legal Notices"
92
+ to the extent that it includes a convenient and prominently visible
93
+ feature that (1) displays an appropriate copyright notice, and (2)
94
+ tells the user that there is no warranty for the work (except to the
95
+ extent that warranties are provided), that licensees may convey the
96
+ work under this License, and how to view a copy of this License. If
97
+ the interface presents a list of user commands or options, such as a
98
+ menu, a prominent item in the list meets this criterion.
99
+
100
+ 1. Source Code.
101
+
102
+ The "source code" for a work means the preferred form of the work
103
+ for making modifications to it. "Object code" means any non-source
104
+ form of a work.
105
+
106
+ A "Standard Interface" means an interface that either is an official
107
+ standard defined by a recognized standards body, or, in the case of
108
+ interfaces specified for a particular programming language, one that
109
+ is widely used among developers working in that language.
110
+
111
+ The "System Libraries" of an executable work include anything, other
112
+ than the work as a whole, that (a) is included in the normal form of
113
+ packaging a Major Component, but which is not part of that Major
114
+ Component, and (b) serves only to enable use of the work with that
115
+ Major Component, or to implement a Standard Interface for which an
116
+ implementation is available to the public in source code form. A
117
+ "Major Component", in this context, means a major essential component
118
+ (kernel, window system, and so on) of the specific operating system
119
+ (if any) on which the executable work runs, or a compiler used to
120
+ produce the work, or an object code interpreter used to run it.
121
+
122
+ The "Corresponding Source" for a work in object code form means all
123
+ the source code needed to generate, install, and (for an executable
124
+ work) run the object code and to modify the work, including scripts to
125
+ control those activities. However, it does not include the work's
126
+ System Libraries, or general-purpose tools or generally available free
127
+ programs which are used unmodified in performing those activities but
128
+ which are not part of the work. For example, Corresponding Source
129
+ includes interface definition files associated with source files for
130
+ the work, and the source code for shared libraries and dynamically
131
+ linked subprograms that the work is specifically designed to require,
132
+ such as by intimate data communication or control flow between those
133
+ subprograms and other parts of the work.
134
+
135
+ The Corresponding Source need not include anything that users
136
+ can regenerate automatically from other parts of the Corresponding
137
+ Source.
138
+
139
+ The Corresponding Source for a work in source code form is that
140
+ same work.
141
+
142
+ 2. Basic Permissions.
143
+
144
+ All rights granted under this License are granted for the term of
145
+ copyright on the Program, and are irrevocable provided the stated
146
+ conditions are met. This License explicitly affirms your unlimited
147
+ permission to run the unmodified Program. The output from running a
148
+ covered work is covered by this License only if the output, given its
149
+ content, constitutes a covered work. This License acknowledges your
150
+ rights of fair use or other equivalent, as provided by copyright law.
151
+
152
+ You may make, run and propagate covered works that you do not
153
+ convey, without conditions so long as your license otherwise remains
154
+ in force. You may convey covered works to others for the sole purpose
155
+ of having them make modifications exclusively for you, or provide you
156
+ with facilities for running those works, provided that you comply with
157
+ the terms of this License in conveying all material for which you do
158
+ not control copyright. Those thus making or running the covered works
159
+ for you must do so exclusively on your behalf, under your direction
160
+ and control, on terms that prohibit them from making any copies of
161
+ your copyrighted material outside their relationship with you.
162
+
163
+ Conveying under any other circumstances is permitted solely under
164
+ the conditions stated below. Sublicensing is not allowed; section 10
165
+ makes it unnecessary.
166
+
167
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168
+
169
+ No covered work shall be deemed part of an effective technological
170
+ measure under any applicable law fulfilling obligations under article
171
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172
+ similar laws prohibiting or restricting circumvention of such
173
+ measures.
174
+
175
+ When you convey a covered work, you waive any legal power to forbid
176
+ circumvention of technological measures to the extent such circumvention
177
+ is effected by exercising rights under this License with respect to
178
+ the covered work, and you disclaim any intention to limit operation or
179
+ modification of the work as a means of enforcing, against the work's
180
+ users, your or third parties' legal rights to forbid circumvention of
181
+ technological measures.
182
+
183
+ 4. Conveying Verbatim Copies.
184
+
185
+ You may convey verbatim copies of the Program's source code as you
186
+ receive it, in any medium, provided that you conspicuously and
187
+ appropriately publish on each copy an appropriate copyright notice;
188
+ keep intact all notices stating that this License and any
189
+ non-permissive terms added in accord with section 7 apply to the code;
190
+ keep intact all notices of the absence of any warranty; and give all
191
+ recipients a copy of this License along with the Program.
192
+
193
+ You may charge any price or no price for each copy that you convey,
194
+ and you may offer support or warranty protection for a fee.
195
+
196
+ 5. Conveying Modified Source Versions.
197
+
198
+ You may convey a work based on the Program, or the modifications to
199
+ produce it from the Program, in the form of source code under the
200
+ terms of section 4, provided that you also meet all of these conditions:
201
+
202
+ a) The work must carry prominent notices stating that you modified
203
+ it, and giving a relevant date.
204
+
205
+ b) The work must carry prominent notices stating that it is
206
+ released under this License and any conditions added under section
207
+ 7. This requirement modifies the requirement in section 4 to
208
+ "keep intact all notices".
209
+
210
+ c) You must license the entire work, as a whole, under this
211
+ License to anyone who comes into possession of a copy. This
212
+ License will therefore apply, along with any applicable section 7
213
+ additional terms, to the whole of the work, and all its parts,
214
+ regardless of how they are packaged. This License gives no
215
+ permission to license the work in any other way, but it does not
216
+ invalidate such permission if you have separately received it.
217
+
218
+ d) If the work has interactive user interfaces, each must display
219
+ Appropriate Legal Notices; however, if the Program has interactive
220
+ interfaces that do not display Appropriate Legal Notices, your
221
+ work need not make them do so.
222
+
223
+ A compilation of a covered work with other separate and independent
224
+ works, which are not by their nature extensions of the covered work,
225
+ and which are not combined with it such as to form a larger program,
226
+ in or on a volume of a storage or distribution medium, is called an
227
+ "aggregate" if the compilation and its resulting copyright are not
228
+ used to limit the access or legal rights of the compilation's users
229
+ beyond what the individual works permit. Inclusion of a covered work
230
+ in an aggregate does not cause this License to apply to the other
231
+ parts of the aggregate.
232
+
233
+ 6. Conveying Non-Source Forms.
234
+
235
+ You may convey a covered work in object code form under the terms
236
+ of sections 4 and 5, provided that you also convey the
237
+ machine-readable Corresponding Source under the terms of this License,
238
+ in one of these ways:
239
+
240
+ a) Convey the object code in, or embodied in, a physical product
241
+ (including a physical distribution medium), accompanied by the
242
+ Corresponding Source fixed on a durable physical medium
243
+ customarily used for software interchange.
244
+
245
+ b) Convey the object code in, or embodied in, a physical product
246
+ (including a physical distribution medium), accompanied by a
247
+ written offer, valid for at least three years and valid for as
248
+ long as you offer spare parts or customer support for that product
249
+ model, to give anyone who possesses the object code either (1) a
250
+ copy of the Corresponding Source for all the software in the
251
+ product that is covered by this License, on a durable physical
252
+ medium customarily used for software interchange, for a price no
253
+ more than your reasonable cost of physically performing this
254
+ conveying of source, or (2) access to copy the
255
+ Corresponding Source from a network server at no charge.
256
+
257
+ c) Convey individual copies of the object code with a copy of the
258
+ written offer to provide the Corresponding Source. This
259
+ alternative is allowed only occasionally and noncommercially, and
260
+ only if you received the object code with such an offer, in accord
261
+ with subsection 6b.
262
+
263
+ d) Convey the object code by offering access from a designated
264
+ place (gratis or for a charge), and offer equivalent access to the
265
+ Corresponding Source in the same way through the same place at no
266
+ further charge. You need not require recipients to copy the
267
+ Corresponding Source along with the object code. If the place to
268
+ copy the object code is a network server, the Corresponding Source
269
+ may be on a different server (operated by you or a third party)
270
+ that supports equivalent copying facilities, provided you maintain
271
+ clear directions next to the object code saying where to find the
272
+ Corresponding Source. Regardless of what server hosts the
273
+ Corresponding Source, you remain obligated to ensure that it is
274
+ available for as long as needed to satisfy these requirements.
275
+
276
+ e) Convey the object code using peer-to-peer transmission, provided
277
+ you inform other peers where the object code and Corresponding
278
+ Source of the work are being offered to the general public at no
279
+ charge under subsection 6d.
280
+
281
+ A separable portion of the object code, whose source code is excluded
282
+ from the Corresponding Source as a System Library, need not be
283
+ included in conveying the object code work.
284
+
285
+ A "User Product" is either (1) a "consumer product", which means any
286
+ tangible personal property which is normally used for personal, family,
287
+ or household purposes, or (2) anything designed or sold for incorporation
288
+ into a dwelling. In determining whether a product is a consumer product,
289
+ doubtful cases shall be resolved in favor of coverage. For a particular
290
+ product received by a particular user, "normally used" refers to a
291
+ typical or common use of that class of product, regardless of the status
292
+ of the particular user or of the way in which the particular user
293
+ actually uses, or expects or is expected to use, the product. A product
294
+ is a consumer product regardless of whether the product has substantial
295
+ commercial, industrial or non-consumer uses, unless such uses represent
296
+ the only significant mode of use of the product.
297
+
298
+ "Installation Information" for a User Product means any methods,
299
+ procedures, authorization keys, or other information required to install
300
+ and execute modified versions of a covered work in that User Product from
301
+ a modified version of its Corresponding Source. The information must
302
+ suffice to ensure that the continued functioning of the modified object
303
+ code is in no case prevented or interfered with solely because
304
+ modification has been made.
305
+
306
+ If you convey an object code work under this section in, or with, or
307
+ specifically for use in, a User Product, and the conveying occurs as
308
+ part of a transaction in which the right of possession and use of the
309
+ User Product is transferred to the recipient in perpetuity or for a
310
+ fixed term (regardless of how the transaction is characterized), the
311
+ Corresponding Source conveyed under this section must be accompanied
312
+ by the Installation Information. But this requirement does not apply
313
+ if neither you nor any third party retains the ability to install
314
+ modified object code on the User Product (for example, the work has
315
+ been installed in ROM).
316
+
317
+ The requirement to provide Installation Information does not include a
318
+ requirement to continue to provide support service, warranty, or updates
319
+ for a work that has been modified or installed by the recipient, or for
320
+ the User Product in which it has been modified or installed. Access to a
321
+ network may be denied when the modification itself materially and
322
+ adversely affects the operation of the network or violates the rules and
323
+ protocols for communication across the network.
324
+
325
+ Corresponding Source conveyed, and Installation Information provided,
326
+ in accord with this section must be in a format that is publicly
327
+ documented (and with an implementation available to the public in
328
+ source code form), and must require no special password or key for
329
+ unpacking, reading or copying.
330
+
331
+ 7. Additional Terms.
332
+
333
+ "Additional permissions" are terms that supplement the terms of this
334
+ License by making exceptions from one or more of its conditions.
335
+ Additional permissions that are applicable to the entire Program shall
336
+ be treated as though they were included in this License, to the extent
337
+ that they are valid under applicable law. If additional permissions
338
+ apply only to part of the Program, that part may be used separately
339
+ under those permissions, but the entire Program remains governed by
340
+ this License without regard to the additional permissions.
341
+
342
+ When you convey a copy of a covered work, you may at your option
343
+ remove any additional permissions from that copy, or from any part of
344
+ it. (Additional permissions may be written to require their own
345
+ removal in certain cases when you modify the work.) You may place
346
+ additional permissions on material, added by you to a covered work,
347
+ for which you have or can give appropriate copyright permission.
348
+
349
+ Notwithstanding any other provision of this License, for material you
350
+ add to a covered work, you may (if authorized by the copyright holders of
351
+ that material) supplement the terms of this License with terms:
352
+
353
+ a) Disclaiming warranty or limiting liability differently from the
354
+ terms of sections 15 and 16 of this License; or
355
+
356
+ b) Requiring preservation of specified reasonable legal notices or
357
+ author attributions in that material or in the Appropriate Legal
358
+ Notices displayed by works containing it; or
359
+
360
+ c) Prohibiting misrepresentation of the origin of that material, or
361
+ requiring that modified versions of such material be marked in
362
+ reasonable ways as different from the original version; or
363
+
364
+ d) Limiting the use for publicity purposes of names of licensors or
365
+ authors of the material; or
366
+
367
+ e) Declining to grant rights under trademark law for use of some
368
+ trade names, trademarks, or service marks; or
369
+
370
+ f) Requiring indemnification of licensors and authors of that
371
+ material by anyone who conveys the material (or modified versions of
372
+ it) with contractual assumptions of liability to the recipient, for
373
+ any liability that these contractual assumptions directly impose on
374
+ those licensors and authors.
375
+
376
+ All other non-permissive additional terms are considered "further
377
+ restrictions" within the meaning of section 10. If the Program as you
378
+ received it, or any part of it, contains a notice stating that it is
379
+ governed by this License along with a term that is a further
380
+ restriction, you may remove that term. If a license document contains
381
+ a further restriction but permits relicensing or conveying under this
382
+ License, you may add to a covered work material governed by the terms
383
+ of that license document, provided that the further restriction does
384
+ not survive such relicensing or conveying.
385
+
386
+ If you add terms to a covered work in accord with this section, you
387
+ must place, in the relevant source files, a statement of the
388
+ additional terms that apply to those files, or a notice indicating
389
+ where to find the applicable terms.
390
+
391
+ Additional terms, permissive or non-permissive, may be stated in the
392
+ form of a separately written license, or stated as exceptions;
393
+ the above requirements apply either way.
394
+
395
+ 8. Termination.
396
+
397
+ You may not propagate or modify a covered work except as expressly
398
+ provided under this License. Any attempt otherwise to propagate or
399
+ modify it is void, and will automatically terminate your rights under
400
+ this License (including any patent licenses granted under the third
401
+ paragraph of section 11).
402
+
403
+ However, if you cease all violation of this License, then your
404
+ license from a particular copyright holder is reinstated (a)
405
+ provisionally, unless and until the copyright holder explicitly and
406
+ finally terminates your license, and (b) permanently, if the copyright
407
+ holder fails to notify you of the violation by some reasonable means
408
+ prior to 60 days after the cessation.
409
+
410
+ Moreover, your license from a particular copyright holder is
411
+ reinstated permanently if the copyright holder notifies you of the
412
+ violation by some reasonable means, this is the first time you have
413
+ received notice of violation of this License (for any work) from that
414
+ copyright holder, and you cure the violation prior to 30 days after
415
+ your receipt of the notice.
416
+
417
+ Termination of your rights under this section does not terminate the
418
+ licenses of parties who have received copies or rights from you under
419
+ this License. If your rights have been terminated and not permanently
420
+ reinstated, you do not qualify to receive new licenses for the same
421
+ material under section 10.
422
+
423
+ 9. Acceptance Not Required for Having Copies.
424
+
425
+ You are not required to accept this License in order to receive or
426
+ run a copy of the Program. Ancillary propagation of a covered work
427
+ occurring solely as a consequence of using peer-to-peer transmission
428
+ to receive a copy likewise does not require acceptance. However,
429
+ nothing other than this License grants you permission to propagate or
430
+ modify any covered work. These actions infringe copyright if you do
431
+ not accept this License. Therefore, by modifying or propagating a
432
+ covered work, you indicate your acceptance of this License to do so.
433
+
434
+ 10. Automatic Licensing of Downstream Recipients.
435
+
436
+ Each time you convey a covered work, the recipient automatically
437
+ receives a license from the original licensors, to run, modify and
438
+ propagate that work, subject to this License. You are not responsible
439
+ for enforcing compliance by third parties with this License.
440
+
441
+ An "entity transaction" is a transaction transferring control of an
442
+ organization, or substantially all assets of one, or subdividing an
443
+ organization, or merging organizations. If propagation of a covered
444
+ work results from an entity transaction, each party to that
445
+ transaction who receives a copy of the work also receives whatever
446
+ licenses to the work the party's predecessor in interest had or could
447
+ give under the previous paragraph, plus a right to possession of the
448
+ Corresponding Source of the work from the predecessor in interest, if
449
+ the predecessor has it or can get it with reasonable efforts.
450
+
451
+ You may not impose any further restrictions on the exercise of the
452
+ rights granted or affirmed under this License. For example, you may
453
+ not impose a license fee, royalty, or other charge for exercise of
454
+ rights granted under this License, and you may not initiate litigation
455
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
456
+ any patent claim is infringed by making, using, selling, offering for
457
+ sale, or importing the Program or any portion of it.
458
+
459
+ 11. Patents.
460
+
461
+ A "contributor" is a copyright holder who authorizes use under this
462
+ License of the Program or a work on which the Program is based. The
463
+ work thus licensed is called the contributor's "contributor version".
464
+
465
+ A contributor's "essential patent claims" are all patent claims
466
+ owned or controlled by the contributor, whether already acquired or
467
+ hereafter acquired, that would be infringed by some manner, permitted
468
+ by this License, of making, using, or selling its contributor version,
469
+ but do not include claims that would be infringed only as a
470
+ consequence of further modification of the contributor version. For
471
+ purposes of this definition, "control" includes the right to grant
472
+ patent sublicenses in a manner consistent with the requirements of
473
+ this License.
474
+
475
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
476
+ patent license under the contributor's essential patent claims, to
477
+ make, use, sell, offer for sale, import and otherwise run, modify and
478
+ propagate the contents of its contributor version.
479
+
480
+ In the following three paragraphs, a "patent license" is any express
481
+ agreement or commitment, however denominated, not to enforce a patent
482
+ (such as an express permission to practice a patent or covenant not to
483
+ sue for patent infringement). To "grant" such a patent license to a
484
+ party means to make such an agreement or commitment not to enforce a
485
+ patent against the party.
486
+
487
+ If you convey a covered work, knowingly relying on a patent license,
488
+ and the Corresponding Source of the work is not available for anyone
489
+ to copy, free of charge and under the terms of this License, through a
490
+ publicly available network server or other readily accessible means,
491
+ then you must either (1) cause the Corresponding Source to be so
492
+ available, or (2) arrange to deprive yourself of the benefit of the
493
+ patent license for this particular work, or (3) arrange, in a manner
494
+ consistent with the requirements of this License, to extend the patent
495
+ license to downstream recipients. "Knowingly relying" means you have
496
+ actual knowledge that, but for the patent license, your conveying the
497
+ covered work in a country, or your recipient's use of the covered work
498
+ in a country, would infringe one or more identifiable patents in that
499
+ country that you have reason to believe are valid.
500
+
501
+ If, pursuant to or in connection with a single transaction or
502
+ arrangement, you convey, or propagate by procuring conveyance of, a
503
+ covered work, and grant a patent license to some of the parties
504
+ receiving the covered work authorizing them to use, propagate, modify
505
+ or convey a specific copy of the covered work, then the patent license
506
+ you grant is automatically extended to all recipients of the covered
507
+ work and works based on it.
508
+
509
+ A patent license is "discriminatory" if it does not include within
510
+ the scope of its coverage, prohibits the exercise of, or is
511
+ conditioned on the non-exercise of one or more of the rights that are
512
+ specifically granted under this License. You may not convey a covered
513
+ work if you are a party to an arrangement with a third party that is
514
+ in the business of distributing software, under which you make payment
515
+ to the third party based on the extent of your activity of conveying
516
+ the work, and under which the third party grants, to any of the
517
+ parties who would receive the covered work from you, a discriminatory
518
+ patent license (a) in connection with copies of the covered work
519
+ conveyed by you (or copies made from those copies), or (b) primarily
520
+ for and in connection with specific products or compilations that
521
+ contain the covered work, unless you entered into that arrangement,
522
+ or that patent license was granted, prior to 28 March 2007.
523
+
524
+ Nothing in this License shall be construed as excluding or limiting
525
+ any implied license or other defenses to infringement that may
526
+ otherwise be available to you under applicable patent law.
527
+
528
+ 12. No Surrender of Others' Freedom.
529
+
530
+ If conditions are imposed on you (whether by court order, agreement or
531
+ otherwise) that contradict the conditions of this License, they do not
532
+ excuse you from the conditions of this License. If you cannot convey a
533
+ covered work so as to satisfy simultaneously your obligations under this
534
+ License and any other pertinent obligations, then as a consequence you may
535
+ not convey it at all. For example, if you agree to terms that obligate you
536
+ to collect a royalty for further conveying from those to whom you convey
537
+ the Program, the only way you could satisfy both those terms and this
538
+ License would be to refrain entirely from conveying the Program.
539
+
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
552
+
553
+ Notwithstanding any other provision of this License, you have
554
+ permission to link or combine any covered work with a work licensed
555
+ under version 3 of the GNU General Public License into a single
556
+ combined work, and to convey the resulting work. The terms of this
557
+ License will continue to apply to the part which is the covered work,
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
560
+
561
+ 14. Revised Versions of this License.
562
+
563
+ The Free Software Foundation may publish revised and/or new versions of
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
566
+ address new problems or concerns.
567
+
568
+ Each version is given a distinguishing version number. If the
569
+ Program specifies that a certain numbered version of the GNU Affero General
570
+ Public License "or any later version" applies to it, you have the
571
+ option of following the terms and conditions either of that numbered
572
+ version or of any later version published by the Free Software
573
+ Foundation. If the Program does not specify a version number of the
574
+ GNU Affero General Public License, you may choose any version ever published
575
+ by the Free Software Foundation.
576
+
577
+ If the Program specifies that a proxy can decide which future
578
+ versions of the GNU Affero General Public License can be used, that proxy's
579
+ public statement of acceptance of a version permanently authorizes you
580
+ to choose that version for the Program.
581
+
582
+ Later license versions may give you additional or different
583
+ permissions. However, no additional obligations are imposed on any
584
+ author or copyright holder as a result of your choosing to follow a
585
+ later version.
586
+
587
+ 15. Disclaimer of Warranty.
588
+
589
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597
+
598
+ 16. Limitation of Liability.
599
+
600
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608
+ SUCH DAMAGES.
609
+
610
+ 17. Interpretation of Sections 15 and 16.
611
+
612
+ If the disclaimer of warranty and limitation of liability provided
613
+ above cannot be given local legal effect according to their terms,
614
+ reviewing courts shall apply local law that most closely approximates
615
+ an absolute waiver of all civil liability in connection with the
616
+ Program, unless a warranty or assumption of liability accompanies a
617
+ copy of the Program in return for a fee.
618
+
619
+ END OF TERMS AND CONDITIONS
620
+
621
+ How to Apply These Terms to Your New Programs
622
+
623
+ If you develop a new program, and you want it to be of the greatest
624
+ possible use to the public, the best way to achieve this is to make it
625
+ free software which everyone can redistribute and change under these terms.
626
+
627
+ To do so, attach the following notices to the program. It is safest
628
+ to attach them to the start of each source file to most effectively
629
+ state the exclusion of warranty; and each file should have at least
630
+ the "copyright" line and a pointer to where the full notice is found.
631
+
632
+ <one line to give the program's name and a brief idea of what it does.>
633
+ Copyright (C) <year> <name of author>
634
+
635
+ This program is free software: you can redistribute it and/or modify
636
+ it under the terms of the GNU Affero General Public License as published by
637
+ the Free Software Foundation, either version 3 of the License, or
638
+ (at your option) any later version.
639
+
640
+ This program is distributed in the hope that it will be useful,
641
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
642
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643
+ GNU Affero General Public License for more details.
644
+
645
+ You should have received a copy of the GNU Affero General Public License
646
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
647
+
648
+ Also add information on how to contact you by electronic and paper mail.
649
+
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
657
+
658
+ You should also get your employer (if you work as a programmer) or school,
659
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
661
+ <https://www.gnu.org/licenses/>.
ultralytics/README.md ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <p>
3
+ <a href="https://www.ultralytics.com/events/yolovision" target="_blank">
4
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png" alt="YOLO Vision banner"></a>
5
+ </p>
6
+
7
+ [中文](https://docs.ultralytics.com/zh/) | [한국어](https://docs.ultralytics.com/ko/) | [日本語](https://docs.ultralytics.com/ja/) | [Русский](https://docs.ultralytics.com/ru/) | [Deutsch](https://docs.ultralytics.com/de/) | [Français](https://docs.ultralytics.com/fr/) | [Español](https://docs.ultralytics.com/es/) | [Português](https://docs.ultralytics.com/pt/) | [Türkçe](https://docs.ultralytics.com/tr/) | [Tiếng Việt](https://docs.ultralytics.com/vi/) | [العربية](https://docs.ultralytics.com/ar/) <br>
8
+
9
+ <div>
10
+ <a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml/badge.svg" alt="Ultralytics CI"></a>
11
+ <a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="Ultralytics YOLOv8 Citation"></a>
12
+ <a href="https://hub.docker.com/r/ultralytics/ultralytics"><img src="https://img.shields.io/docker/pulls/ultralytics/ultralytics?logo=docker" alt="Ultralytics Docker Pulls"></a>
13
+ <a href="https://ultralytics.com/discord"><img alt="Ultralytics Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
14
+ <a href="https://community.ultralytics.com"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>
15
+ <br>
16
+ <a href="https://console.paperspace.com/github/ultralytics/ultralytics"><img src="https://assets.paperspace.io/img/gradient-badge.svg" alt="Run Ultralytics on Gradient"></a>
17
+ <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Ultralytics In Colab"></a>
18
+ <a href="https://www.kaggle.com/ultralytics/yolov8"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open Ultralytics In Kaggle"></a>
19
+ </div>
20
+ <br>
21
+
22
+ [Ultralytics](https://ultralytics.com) [YOLOv8](https://github.com/ultralytics/ultralytics) is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification and pose estimation tasks.
23
+
24
+ We hope that the resources here will help you get the most out of YOLOv8. Please browse the YOLOv8 <a href="https://docs.ultralytics.com/">Docs</a> for details, raise an issue on <a href="https://github.com/ultralytics/ultralytics/issues/new/choose">GitHub</a> for support, and join our <a href="https://ultralytics.com/discord">Discord</a> community for questions and discussions!
25
+
26
+ To request an Enterprise License please complete the form at [Ultralytics Licensing](https://ultralytics.com/license).
27
+
28
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/yolo-comparison-plots.png" alt="YOLOv8 performance plots"></a>
29
+
30
+ <div align="center">
31
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="2%" alt="Ultralytics GitHub"></a>
32
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
33
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="2%" alt="Ultralytics LinkedIn"></a>
34
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
35
+ <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="2%" alt="Ultralytics Twitter"></a>
36
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
37
+ <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="2%" alt="Ultralytics YouTube"></a>
38
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
39
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="2%" alt="Ultralytics TikTok"></a>
40
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
41
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="2%" alt="Ultralytics BiliBili"></a>
42
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
43
+ <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="2%" alt="Ultralytics Discord"></a>
44
+ </div>
45
+ </div>
46
+
47
+ ## <div align="center">Documentation</div>
48
+
49
+ See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com) for full documentation on training, validation, prediction and deployment.
50
+
51
+ <details open>
52
+ <summary>Install</summary>
53
+
54
+ Pip install the ultralytics package including all [requirements](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) in a [**Python>=3.8**](https://www.python.org/) environment with [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/).
55
+
56
+ [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)
57
+
58
+ ```bash
59
+ pip install ultralytics
60
+ ```
61
+
62
+ For alternative installation methods including [Conda](https://anaconda.org/conda-forge/ultralytics), [Docker](https://hub.docker.com/r/ultralytics/ultralytics), and Git, please refer to the [Quickstart Guide](https://docs.ultralytics.com/quickstart).
63
+
64
+ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/ultralytics?logo=condaforge)](https://anaconda.org/conda-forge/ultralytics) [![Docker Image Version](https://img.shields.io/docker/v/ultralytics/ultralytics?sort=semver&logo=docker)](https://hub.docker.com/r/ultralytics/ultralytics)
65
+
66
+ </details>
67
+
68
+ <details open>
69
+ <summary>Usage</summary>
70
+
71
+ ### CLI
72
+
73
+ YOLOv8 may be used directly in the Command Line Interface (CLI) with a `yolo` command:
74
+
75
+ ```bash
76
+ yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
77
+ ```
78
+
79
+ `yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See the YOLOv8 [CLI Docs](https://docs.ultralytics.com/usage/cli) for examples.
80
+
81
+ ### Python
82
+
83
+ YOLOv8 may also be used directly in a Python environment, and accepts the same [arguments](https://docs.ultralytics.com/usage/cfg/) as in the CLI example above:
84
+
85
+ ```python
86
+ from ultralytics import YOLO
87
+
88
+ # Load a model
89
+ model = YOLO("yolov8n.yaml") # build a new model from scratch
90
+ model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
91
+
92
+ # Use the model
93
+ model.train(data="coco8.yaml", epochs=3) # train the model
94
+ metrics = model.val() # evaluate model performance on the validation set
95
+ results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
96
+ path = model.export(format="onnx") # export the model to ONNX format
97
+ ```
98
+
99
+ See YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python) for more examples.
100
+
101
+ </details>
102
+
103
+ ### Notebooks
104
+
105
+ Ultralytics provides interactive notebooks for YOLOv8, covering training, validation, tracking, and more. Each notebook is paired with a [YouTube](https://youtube.com/ultralytics?sub_confirmation=1) tutorial, making it easy to learn and implement advanced YOLOv8 features.
106
+
107
+ | Docs | Notebook | YouTube |
108
+ | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
109
+ | <a href="https://docs.ultralytics.com/modes/">YOLOv8 Train, Val, Predict and Export Modes</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/j8uQc0qB91s"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
110
+ | <a href="https://docs.ultralytics.com/hub/quickstart/">Ultralytics HUB QuickStart</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/hub.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/lveF9iCMIzc"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
111
+ | <a href="https://docs.ultralytics.com/modes/track/">YOLOv8 Multi-Object Tracking in Videos</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/object_tracking.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/hHyHmOtmEgs"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
112
+ | <a href="https://docs.ultralytics.com/guides/object-counting/">YOLOv8 Object Counting in Videos</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/object_counting.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/Ag2e-5_NpS0"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
113
+ | <a href="https://docs.ultralytics.com/guides/heatmaps/">YOLOv8 Heatmaps in Videos</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/heatmaps.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/4ezde5-nZZw"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
114
+ | <a href="https://docs.ultralytics.com/datasets/explorer/">Ultralytics Datasets Explorer with SQL and OpenAI Integration 🚀 New</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> | <a href="https://youtu.be/3VryynorQeo"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
115
+
116
+ ## <div align="center">Models</div>
117
+
118
+ YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect), [Segment](https://docs.ultralytics.com/tasks/segment) and [Pose](https://docs.ultralytics.com/tasks/pose) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/tasks/classify) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet) dataset. [Track](https://docs.ultralytics.com/modes/track) mode is available for all Detect, Segment and Pose models.
119
+
120
+ <img width="1024" src="https://raw.githubusercontent.com/ultralytics/assets/main/im/banner-tasks.png" alt="Ultralytics YOLO supported tasks">
121
+
122
+ All [Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/models) download automatically from the latest Ultralytics [release](https://github.com/ultralytics/assets/releases) on first use.
123
+
124
+ <details open><summary>Detection (COCO)</summary>
125
+
126
+ See [Detection Docs](https://docs.ultralytics.com/tasks/detect/) for usage examples with these models trained on [COCO](https://docs.ultralytics.com/datasets/detect/coco/), which include 80 pre-trained classes.
127
+
128
+ | Model | size<br><sup>(pixels) | mAP<sup>val<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
129
+ | ------------------------------------------------------------------------------------ | --------------------- | -------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
130
+ | [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt) | 640 | 37.3 | 80.4 | 0.99 | 3.2 | 8.7 |
131
+ | [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s.pt) | 640 | 44.9 | 128.4 | 1.20 | 11.2 | 28.6 |
132
+ | [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m.pt) | 640 | 50.2 | 234.7 | 1.83 | 25.9 | 78.9 |
133
+ | [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l.pt) | 640 | 52.9 | 375.2 | 2.39 | 43.7 | 165.2 |
134
+ | [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x.pt) | 640 | 53.9 | 479.1 | 3.53 | 68.2 | 257.8 |
135
+
136
+ - **mAP<sup>val</sup>** values are for single-model single-scale on [COCO val2017](https://cocodataset.org) dataset. <br>Reproduce by `yolo val detect data=coco.yaml device=0`
137
+ - **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val detect data=coco.yaml batch=1 device=0|cpu`
138
+
139
+ </details>
140
+
141
+ <details><summary>Detection (Open Image V7)</summary>
142
+
143
+ See [Detection Docs](https://docs.ultralytics.com/tasks/detect/) for usage examples with these models trained on [Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/), which include 600 pre-trained classes.
144
+
145
+ | Model | size<br><sup>(pixels) | mAP<sup>val<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
146
+ | ----------------------------------------------------------------------------------------- | --------------------- | -------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
147
+ | [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-oiv7.pt) | 640 | 18.4 | 142.4 | 1.21 | 3.5 | 10.5 |
148
+ | [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-oiv7.pt) | 640 | 27.7 | 183.1 | 1.40 | 11.4 | 29.7 |
149
+ | [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-oiv7.pt) | 640 | 33.6 | 408.5 | 2.26 | 26.2 | 80.6 |
150
+ | [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-oiv7.pt) | 640 | 34.9 | 596.9 | 2.43 | 44.1 | 167.4 |
151
+ | [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-oiv7.pt) | 640 | 36.3 | 860.6 | 3.56 | 68.7 | 260.6 |
152
+
153
+ - **mAP<sup>val</sup>** values are for single-model single-scale on [Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/) dataset. <br>Reproduce by `yolo val detect data=open-images-v7.yaml device=0`
154
+ - **Speed** averaged over Open Image V7 val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val detect data=open-images-v7.yaml batch=1 device=0|cpu`
155
+
156
+ </details>
157
+
158
+ <details><summary>Segmentation (COCO)</summary>
159
+
160
+ See [Segmentation Docs](https://docs.ultralytics.com/tasks/segment/) for usage examples with these models trained on [COCO-Seg](https://docs.ultralytics.com/datasets/segment/coco/), which include 80 pre-trained classes.
161
+
162
+ | Model | size<br><sup>(pixels) | mAP<sup>box<br>50-95 | mAP<sup>mask<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
163
+ | -------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
164
+ | [YOLOv8n-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-seg.pt) | 640 | 36.7 | 30.5 | 96.1 | 1.21 | 3.4 | 12.6 |
165
+ | [YOLOv8s-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-seg.pt) | 640 | 44.6 | 36.8 | 155.7 | 1.47 | 11.8 | 42.6 |
166
+ | [YOLOv8m-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-seg.pt) | 640 | 49.9 | 40.8 | 317.0 | 2.18 | 27.3 | 110.2 |
167
+ | [YOLOv8l-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-seg.pt) | 640 | 52.3 | 42.6 | 572.4 | 2.79 | 46.0 | 220.5 |
168
+ | [YOLOv8x-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-seg.pt) | 640 | 53.4 | 43.4 | 712.1 | 4.02 | 71.8 | 344.1 |
169
+
170
+ - **mAP<sup>val</sup>** values are for single-model single-scale on [COCO val2017](https://cocodataset.org) dataset. <br>Reproduce by `yolo val segment data=coco-seg.yaml device=0`
171
+ - **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val segment data=coco-seg.yaml batch=1 device=0|cpu`
172
+
173
+ </details>
174
+
175
+ <details><summary>Pose (COCO)</summary>
176
+
177
+ See [Pose Docs](https://docs.ultralytics.com/tasks/pose/) for usage examples with these models trained on [COCO-Pose](https://docs.ultralytics.com/datasets/pose/coco/), which include 1 pre-trained class, person.
178
+
179
+ | Model | size<br><sup>(pixels) | mAP<sup>pose<br>50-95 | mAP<sup>pose<br>50 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
180
+ | ---------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | ------------------ | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
181
+ | [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-pose.pt) | 640 | 50.4 | 80.1 | 131.8 | 1.18 | 3.3 | 9.2 |
182
+ | [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-pose.pt) | 640 | 60.0 | 86.2 | 233.2 | 1.42 | 11.6 | 30.2 |
183
+ | [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-pose.pt) | 640 | 65.0 | 88.8 | 456.3 | 2.00 | 26.4 | 81.0 |
184
+ | [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-pose.pt) | 640 | 67.6 | 90.0 | 784.5 | 2.59 | 44.4 | 168.6 |
185
+ | [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-pose.pt) | 640 | 69.2 | 90.2 | 1607.1 | 3.73 | 69.4 | 263.2 |
186
+ | [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-pose-p6.pt) | 1280 | 71.6 | 91.2 | 4088.7 | 10.04 | 99.1 | 1066.4 |
187
+
188
+ - **mAP<sup>val</sup>** values are for single-model single-scale on [COCO Keypoints val2017](https://cocodataset.org) dataset. <br>Reproduce by `yolo val pose data=coco-pose.yaml device=0`
189
+ - **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val pose data=coco-pose.yaml batch=1 device=0|cpu`
190
+
191
+ </details>
192
+
193
+ <details><summary>OBB (DOTAv1)</summary>
194
+
195
+ See [OBB Docs](https://docs.ultralytics.com/tasks/obb/) for usage examples with these models trained on [DOTAv1](https://docs.ultralytics.com/datasets/obb/dota-v2/#dota-v10/), which include 15 pre-trained classes.
196
+
197
+ | Model | size<br><sup>(pixels) | mAP<sup>test<br>50 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
198
+ | -------------------------------------------------------------------------------------------- | --------------------- | ------------------ | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
199
+ | [YOLOv8n-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-obb.pt) | 1024 | 78.0 | 204.77 | 3.57 | 3.1 | 23.3 |
200
+ | [YOLOv8s-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-obb.pt) | 1024 | 79.5 | 424.88 | 4.07 | 11.4 | 76.3 |
201
+ | [YOLOv8m-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-obb.pt) | 1024 | 80.5 | 763.48 | 7.61 | 26.4 | 208.6 |
202
+ | [YOLOv8l-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-obb.pt) | 1024 | 80.7 | 1278.42 | 11.83 | 44.5 | 433.8 |
203
+ | [YOLOv8x-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-obb.pt) | 1024 | 81.36 | 1759.10 | 13.23 | 69.5 | 676.7 |
204
+
205
+ - **mAP<sup>test</sup>** values are for single-model multiscale on [DOTAv1](https://captain-whu.github.io/DOTA/index.html) dataset. <br>Reproduce by `yolo val obb data=DOTAv1.yaml device=0 split=test` and submit merged results to [DOTA evaluation](https://captain-whu.github.io/DOTA/evaluation.html).
206
+ - **Speed** averaged over DOTAv1 val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val obb data=DOTAv1.yaml batch=1 device=0|cpu`
207
+
208
+ </details>
209
+
210
+ <details><summary>Classification (ImageNet)</summary>
211
+
212
+ See [Classification Docs](https://docs.ultralytics.com/tasks/classify/) for usage examples with these models trained on [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/), which include 1000 pretrained classes.
213
+
214
+ | Model | size<br><sup>(pixels) | acc<br><sup>top1 | acc<br><sup>top5 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) at 640 |
215
+ | -------------------------------------------------------------------------------------------- | --------------------- | ---------------- | ---------------- | ------------------------------ | ----------------------------------- | ------------------ | ------------------------ |
216
+ | [YOLOv8n-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-cls.pt) | 224 | 69.0 | 88.3 | 12.9 | 0.31 | 2.7 | 4.3 |
217
+ | [YOLOv8s-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-cls.pt) | 224 | 73.8 | 91.7 | 23.4 | 0.35 | 6.4 | 13.5 |
218
+ | [YOLOv8m-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-cls.pt) | 224 | 76.8 | 93.5 | 85.4 | 0.62 | 17.0 | 42.7 |
219
+ | [YOLOv8l-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-cls.pt) | 224 | 78.3 | 94.2 | 163.0 | 0.87 | 37.5 | 99.7 |
220
+ | [YOLOv8x-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-cls.pt) | 224 | 79.0 | 94.6 | 232.0 | 1.01 | 57.4 | 154.8 |
221
+
222
+ - **acc** values are model accuracies on the [ImageNet](https://www.image-net.org/) dataset validation set. <br>Reproduce by `yolo val classify data=path/to/ImageNet device=0`
223
+ - **Speed** averaged over ImageNet val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val classify data=path/to/ImageNet batch=1 device=0|cpu`
224
+
225
+ </details>
226
+
227
+ ## <div align="center">Integrations</div>
228
+
229
+ Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with [Roboflow](https://roboflow.com/?ref=ultralytics), ClearML, [Comet](https://bit.ly/yolov8-readme-comet), Neural Magic and [OpenVINO](https://docs.ultralytics.com/integrations/openvino), can optimize your AI workflow.
230
+
231
+ <br>
232
+ <a href="https://ultralytics.com/hub" target="_blank">
233
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png" alt="Ultralytics active learning integrations"></a>
234
+ <br>
235
+ <br>
236
+
237
+ <div align="center">
238
+ <a href="https://roboflow.com/?ref=ultralytics">
239
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-roboflow.png" width="10%" alt="Roboflow logo"></a>
240
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
241
+ <a href="https://clear.ml/">
242
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-clearml.png" width="10%" alt="ClearML logo"></a>
243
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
244
+ <a href="https://bit.ly/yolov8-readme-comet">
245
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-comet.png" width="10%" alt="Comet ML logo"></a>
246
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
247
+ <a href="https://bit.ly/yolov5-neuralmagic">
248
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-neuralmagic.png" width="10%" alt="NeuralMagic logo"></a>
249
+ </div>
250
+
251
+ | Roboflow | ClearML ⭐ NEW | Comet ⭐ NEW | Neural Magic ⭐ NEW |
252
+ | :--------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------: |
253
+ | Label and export your custom datasets directly to YOLOv8 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) | Automatically track, visualize and even remotely train YOLOv8 using [ClearML](https://clear.ml/) (open-source!) | Free forever, [Comet](https://bit.ly/yolov8-readme-comet) lets you save YOLOv8 models, resume training, and interactively visualize and debug predictions | Run YOLOv8 inference up to 6x faster with [Neural Magic DeepSparse](https://bit.ly/yolov5-neuralmagic) |
254
+
255
+ ## <div align="center">Ultralytics HUB</div>
256
+
257
+ Experience seamless AI with [Ultralytics HUB](https://ultralytics.com/hub) ⭐, the all-in-one solution for data visualization, YOLOv5 and YOLOv8 🚀 model training and deployment, without any coding. Transform images into actionable insights and bring your AI visions to life with ease using our cutting-edge platform and user-friendly [Ultralytics App](https://ultralytics.com/app_install). Start your journey for **Free** now!
258
+
259
+ <a href="https://ultralytics.com/hub" target="_blank">
260
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/ultralytics-hub.png" alt="Ultralytics HUB preview image"></a>
261
+
262
+ ## <div align="center">Contribute</div>
263
+
264
+ We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing) to get started, and fill out our [Survey](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
265
+
266
+ <!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
267
+
268
+ <a href="https://github.com/ultralytics/ultralytics/graphs/contributors">
269
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/image-contributors.png" alt="Ultralytics open-source contributors"></a>
270
+
271
+ ## <div align="center">License</div>
272
+
273
+ Ultralytics offers two licensing options to accommodate diverse use cases:
274
+
275
+ - **AGPL-3.0 License**: This [OSI-approved](https://opensource.org/licenses/) open-source license is ideal for students and enthusiasts, promoting open collaboration and knowledge sharing. See the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for more details.
276
+ - **Enterprise License**: Designed for commercial use, this license permits seamless integration of Ultralytics software and AI models into commercial goods and services, bypassing the open-source requirements of AGPL-3.0. If your scenario involves embedding our solutions into a commercial offering, reach out through [Ultralytics Licensing](https://ultralytics.com/license).
277
+
278
+ ## <div align="center">Contact</div>
279
+
280
+ For Ultralytics bug reports and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues), and join our [Discord](https://ultralytics.com/discord) community for questions and discussions!
281
+
282
+ <br>
283
+ <div align="center">
284
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
285
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
286
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
287
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
288
+ <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
289
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
290
+ <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
291
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
292
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
293
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
294
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
295
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
296
+ <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
297
+ </div>
ultralytics/README.zh-CN.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <p>
3
+ <a href="https://www.ultralytics.com/events/yolovision" target="_blank">
4
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png" alt="YOLO Vision banner"></a>
5
+ </p>
6
+
7
+ [中文](https://docs.ultralytics.com/zh/) | [한국어](https://docs.ultralytics.com/ko/) | [日本語](https://docs.ultralytics.com/ja/) | [Русский](https://docs.ultralytics.com/ru/) | [Deutsch](https://docs.ultralytics.com/de/) | [Français](https://docs.ultralytics.com/fr/) | [Español](https://docs.ultralytics.com/es/) | [Português](https://docs.ultralytics.com/pt/) | [Türkçe](https://docs.ultralytics.com/tr/) | [Tiếng Việt](https://docs.ultralytics.com/vi/) | [العربية](https://docs.ultralytics.com/ar/) <br>
8
+
9
+ <div>
10
+ <a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml/badge.svg" alt="Ultralytics CI"></a>
11
+ <a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="YOLOv8 Citation"></a>
12
+ <a href="https://hub.docker.com/r/ultralytics/ultralytics"><img src="https://img.shields.io/docker/pulls/ultralytics/ultralytics?logo=docker" alt="Docker Pulls"></a>
13
+ <a href="https://ultralytics.com/discord"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
14
+ <a href="https://community.ultralytics.com"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>
15
+ <br>
16
+ <a href="https://console.paperspace.com/github/ultralytics/ultralytics"><img src="https://assets.paperspace.io/img/gradient-badge.svg" alt="Run on Gradient"></a>
17
+ <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
18
+ <a href="https://www.kaggle.com/ultralytics/yolov8"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
19
+ </div>
20
+ <br>
21
+
22
+ [Ultralytics](https://ultralytics.com) [YOLOv8](https://github.com/ultralytics/ultralytics) 是一款前沿、最先进(SOTA)的模型,基于先前 YOLO 版本的成功,引入了新功能和改进,进一步提升性能和灵活性。YOLOv8 设计快速、准确且易于使用,使其成为各种物体检测与跟踪、实例分割、图像分类和姿态估计任务的绝佳选择。
23
+
24
+ 我们希望这里的资源能帮助您充分利用 YOLOv8。请浏览 YOLOv8 <a href="https://docs.ultralytics.com/">文档</a> 了解详细信息,在 <a href="https://github.com/ultralytics/ultralytics/issues/new/choose">GitHub</a> 上提交问题以获得支持,并加入我们的 <a href="https://ultralytics.com/discord">Discord</a> 社区进行问题和讨论!
25
+
26
+ 如需申请企业许可,请在 [Ultralytics Licensing](https://ultralytics.com/license) 处填写表格
27
+
28
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/yolo-comparison-plots.png" alt="YOLOv8 performance plots"></a>
29
+
30
+ <div align="center">
31
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="2%" alt="Ultralytics GitHub"></a>
32
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
33
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="2%" alt="Ultralytics LinkedIn"></a>
34
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
35
+ <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="2%" alt="Ultralytics Twitter"></a>
36
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
37
+ <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="2%" alt="Ultralytics YouTube"></a>
38
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
39
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="2%" alt="Ultralytics TikTok"></a>
40
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
41
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="2%" alt="Ultralytics BiliBili"></a>
42
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
43
+ <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="2%" alt="Ultralytics Discord"></a>
44
+ </div>
45
+ </div>
46
+
47
+ 以下是提供的内容的中文翻译:
48
+
49
+ ## <div align="center">文档</div>
50
+
51
+ 请参阅下面的快速安装和使用示例,以及 [YOLOv8 文档](https://docs.ultralytics.com) 上有关训练、验证、预测和部署的完整文档。
52
+
53
+ <details open>
54
+ <summary>安装</summary>
55
+
56
+ 使用Pip在一个[**Python>=3.8**](https://www.python.org/)环境中安装`ultralytics`包,此环境还需包含[**PyTorch>=1.8**](https://pytorch.org/get-started/locally/)。这也会安装所有必要的[依赖项](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml)。
57
+
58
+ [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)
59
+
60
+ ```bash
61
+ pip install ultralytics
62
+ ```
63
+
64
+ 如需使用包括[Conda](https://anaconda.org/conda-forge/ultralytics),[Docker](https://hub.docker.com/r/ultralytics/ultralytics)和Git在内的其他安装方法,请参考[快速入门指南](https://docs.ultralytics.com/quickstart)。
65
+
66
+ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/ultralytics?logo=condaforge)](https://anaconda.org/conda-forge/ultralytics) [![Docker Image Version](https://img.shields.io/docker/v/ultralytics/ultralytics?sort=semver&logo=docker)](https://hub.docker.com/r/ultralytics/ultralytics)
67
+
68
+ </details>
69
+
70
+ <details open>
71
+ <summary>Usage</summary>
72
+
73
+ ### CLI
74
+
75
+ YOLOv8 可以在命令行界面(CLI)中直接使用,只需输入 `yolo` 命令:
76
+
77
+ ```bash
78
+ yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
79
+ ```
80
+
81
+ `yolo` 可用于各种任务和模式,并接受其他参数,例如 `imgsz=640`。查看 YOLOv8 [CLI 文档](https://docs.ultralytics.com/usage/cli)以获取示例。
82
+
83
+ ### Python
84
+
85
+ YOLOv8 也可以在 Python 环境中直接使用,并接受与上述 CLI 示例中相同的[参数](https://docs.ultralytics.com/usage/cfg/):
86
+
87
+ ```python
88
+ from ultralytics import YOLO
89
+
90
+ # 加载模型
91
+ model = YOLO("yolov8n.yaml") # 从头开始构建新模型
92
+ model = YOLO("yolov8n.pt") # 加载预训练模型(建议用于训练)
93
+
94
+ # 使用模型
95
+ model.train(data="coco8.yaml", epochs=3) # 训练模型
96
+ metrics = model.val() # 在验证集上评估模型性能
97
+ results = model("https://ultralytics.com/images/bus.jpg") # 对图像进行预测
98
+ success = model.export(format="onnx") # 将模型导出为 ONNX 格式
99
+ ```
100
+
101
+ 查看 YOLOv8 [Python 文档](https://docs.ultralytics.com/usage/python)以获取更多示例。
102
+
103
+ </details>
104
+
105
+ ### 笔记本
106
+
107
+ Ultralytics 提供了 YOLOv8 的交互式笔记本,涵盖训练、验证、跟踪等内容。每个笔记本都配有 [YouTube](https://youtube.com/ultralytics?sub_confirmation=1) 教程,使学习和实现高级 YOLOv8 功能变得简单。
108
+
109
+ | 文档 | 笔记本 | YouTube |
110
+ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
111
+ | <a href="https://docs.ultralytics.com/modes/">YOLOv8 训练、验证、预测和导出模式</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/j8uQc0qB91s"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube 视频"></center></a> |
112
+ | <a href="https://docs.ultralytics.com/hub/quickstart/">Ultralytics HUB 快速开始</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/hub.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/lveF9iCMIzc"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube 视频"></center></a> |
113
+ | <a href="https://docs.ultralytics.com/modes/track/">YOLOv8 视频中的多对象跟踪</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/object_tracking.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/hHyHmOtmEgs"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube 视频"></center></a> |
114
+ | <a href="https://docs.ultralytics.com/guides/object-counting/">YOLOv8 视频中的对象计数</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/object_counting.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/Ag2e-5_NpS0"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube 视频"></center></a> |
115
+ | <a href="https://docs.ultralytics.com/guides/heatmaps/">YOLOv8 视频中的热图</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/heatmaps.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/4ezde5-nZZw"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube 视频"></center></a> |
116
+ | <a href="https://docs.ultralytics.com/datasets/explorer/">Ultralytics 数据集浏览器,集成 SQL 和 OpenAI 🚀 New</a> | <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="在 Colab 中打开"></a> | <a href="https://youtu.be/3VryynorQeo"><center><img width=30% src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube-rect.png" alt="Ultralytics Youtube Video"></center></a> |
117
+
118
+ ## <div align="center">模型</div>
119
+
120
+ 在[COCO](https://docs.ultralytics.com/datasets/detect/coco)数据集上预训练的YOLOv8 [检测](https://docs.ultralytics.com/tasks/detect),[分割](https://docs.ultralytics.com/tasks/segment)和[姿态](https://docs.ultralytics.com/tasks/pose)模型可以在这里找到,以及在[ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet)数据集上预训练的YOLOv8 [分类](https://docs.ultralytics.com/tasks/classify)模型。所有的检测,分割和姿态模型都支持[追踪](https://docs.ultralytics.com/modes/track)模式。
121
+
122
+ <img width="1024" src="https://raw.githubusercontent.com/ultralytics/assets/main/im/banner-tasks.png" alt="Ultralytics YOLO supported tasks">
123
+
124
+ 所有[模型](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/models)在首次使用时会自动从最新的Ultralytics [发布版本](https://github.com/ultralytics/assets/releases)下载。
125
+
126
+ <details open><summary>检测 (COCO)</summary>
127
+
128
+ 查看[检测文档](https://docs.ultralytics.com/tasks/detect/)以获取这些在[COCO](https://docs.ultralytics.com/datasets/detect/coco/)上训练的模型的使用示例,其中包括80个预训练类别。
129
+
130
+ | 模型 | 尺寸<br><sup>(像素) | mAP<sup>val<br>50-95 | 速度<br><sup>CPU ONNX<br>(ms) | 速度<br><sup>A100 TensorRT<br>(ms) | 参数<br><sup>(M) | FLOPs<br><sup>(B) |
131
+ | ------------------------------------------------------------------------------------ | ------------------- | -------------------- | ----------------------------- | ---------------------------------- | ---------------- | ----------------- |
132
+ | [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt) | 640 | 37.3 | 80.4 | 0.99 | 3.2 | 8.7 |
133
+ | [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s.pt) | 640 | 44.9 | 128.4 | 1.20 | 11.2 | 28.6 |
134
+ | [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m.pt) | 640 | 50.2 | 234.7 | 1.83 | 25.9 | 78.9 |
135
+ | [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l.pt) | 640 | 52.9 | 375.2 | 2.39 | 43.7 | 165.2 |
136
+ | [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x.pt) | 640 | 53.9 | 479.1 | 3.53 | 68.2 | 257.8 |
137
+
138
+ - **mAP<sup>val</sup>** 值是基于单模型单尺度在 [COCO val2017](https://cocodataset.org) 数据集上的结果。 <br>通过 `yolo val detect data=coco.yaml device=0` 复现
139
+ - **速度** 是使用 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例对 COCO val 图像进行平均计算的。 <br>通过 `yolo val detect data=coco.yaml batch=1 device=0|cpu` 复现
140
+
141
+ </details>
142
+
143
+ <details><summary>检测(Open Image V7)</summary>
144
+
145
+ 查看[检测文档](https://docs.ultralytics.com/tasks/detect/)以获取这些在[Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/)上训练的模型的使用示例,其中包括600个预训练类别。
146
+
147
+ | 模型 | 尺寸<br><sup>(像素) | mAP<sup>验证<br>50-95 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>A100 TensorRT<br>(毫秒) | 参数<br><sup>(M) | 浮点运算<br><sup>(B) |
148
+ | ----------------------------------------------------------------------------------------- | ------------------- | --------------------- | ------------------------------- | ------------------------------------ | ---------------- | -------------------- |
149
+ | [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-oiv7.pt) | 640 | 18.4 | 142.4 | 1.21 | 3.5 | 10.5 |
150
+ | [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-oiv7.pt) | 640 | 27.7 | 183.1 | 1.40 | 11.4 | 29.7 |
151
+ | [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-oiv7.pt) | 640 | 33.6 | 408.5 | 2.26 | 26.2 | 80.6 |
152
+ | [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-oiv7.pt) | 640 | 34.9 | 596.9 | 2.43 | 44.1 | 167.4 |
153
+ | [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-oiv7.pt) | 640 | 36.3 | 860.6 | 3.56 | 68.7 | 260.6 |
154
+
155
+ - **mAP<sup>验证</sup>** 值适用于在[Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/)数据集上的单模型单尺度。 <br>通过 `yolo val detect data=open-images-v7.yaml device=0` 以复现。
156
+ - **速度** 在使用[Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/)实例对Open Image V7验证图像进行平均测算。 <br>通过 `yolo val detect data=open-images-v7.yaml batch=1 device=0|cpu` 以复现。
157
+
158
+ </details>
159
+
160
+ <details><summary>分割 (COCO)</summary>
161
+
162
+ 查看[分割文档](https://docs.ultralytics.com/tasks/segment/)以获取这些在[COCO-Seg](https://docs.ultralytics.com/datasets/segment/coco/)上训练的模型的使用示例,其中包括80个预训练类别。
163
+
164
+ | 模型 | 尺寸<br><sup>(像素) | mAP<sup>box<br>50-95 | mAP<sup>mask<br>50-95 | 速度<br><sup>CPU ONNX<br>(ms) | 速度<br><sup>A100 TensorRT<br>(ms) | 参数<br><sup>(M) | FLOPs<br><sup>(B) |
165
+ | -------------------------------------------------------------------------------------------- | ------------------- | -------------------- | --------------------- | ----------------------------- | ---------------------------------- | ---------------- | ----------------- |
166
+ | [YOLOv8n-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-seg.pt) | 640 | 36.7 | 30.5 | 96.1 | 1.21 | 3.4 | 12.6 |
167
+ | [YOLOv8s-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-seg.pt) | 640 | 44.6 | 36.8 | 155.7 | 1.47 | 11.8 | 42.6 |
168
+ | [YOLOv8m-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-seg.pt) | 640 | 49.9 | 40.8 | 317.0 | 2.18 | 27.3 | 110.2 |
169
+ | [YOLOv8l-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-seg.pt) | 640 | 52.3 | 42.6 | 572.4 | 2.79 | 46.0 | 220.5 |
170
+ | [YOLOv8x-seg](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-seg.pt) | 640 | 53.4 | 43.4 | 712.1 | 4.02 | 71.8 | 344.1 |
171
+
172
+ - **mAP<sup>val</sup>** 值是基于单模型单尺度在 [COCO val2017](https://cocodataset.org) 数据集上的结果。 <br>通过 `yolo val segment data=coco-seg.yaml device=0` 复现
173
+ - **速度** 是使用 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例对 COCO val 图像进行平均计算的。 <br>通过 `yolo val segment data=coco-seg.yaml batch=1 device=0|cpu` 复现
174
+
175
+ </details>
176
+
177
+ <details><summary>姿态 (COCO)</summary>
178
+
179
+ 查看[姿态文档](https://docs.ultralytics.com/tasks/pose/)以获取这些在[COCO-Pose](https://docs.ultralytics.com/datasets/pose/coco/)上训练的模型的使用示例,其中包括1个预训练类别,即人。
180
+
181
+ | 模型 | 尺寸<br><sup>(像素) | mAP<sup>pose<br>50-95 | mAP<sup>pose<br>50 | 速度<br><sup>CPU ONNX<br>(ms) | 速度<br><sup>A100 TensorRT<br>(ms) | 参数<br><sup>(M) | FLOPs<br><sup>(B) |
182
+ | ---------------------------------------------------------------------------------------------------- | ------------------- | --------------------- | ------------------ | ----------------------------- | ---------------------------------- | ---------------- | ----------------- |
183
+ | [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-pose.pt) | 640 | 50.4 | 80.1 | 131.8 | 1.18 | 3.3 | 9.2 |
184
+ | [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-pose.pt) | 640 | 60.0 | 86.2 | 233.2 | 1.42 | 11.6 | 30.2 |
185
+ | [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-pose.pt) | 640 | 65.0 | 88.8 | 456.3 | 2.00 | 26.4 | 81.0 |
186
+ | [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-pose.pt) | 640 | 67.6 | 90.0 | 784.5 | 2.59 | 44.4 | 168.6 |
187
+ | [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-pose.pt) | 640 | 69.2 | 90.2 | 1607.1 | 3.73 | 69.4 | 263.2 |
188
+ | [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-pose-p6.pt) | 1280 | 71.6 | 91.2 | 4088.7 | 10.04 | 99.1 | 1066.4 |
189
+
190
+ - **mAP<sup>val</sup>** 值是基于单模型单尺度在 [COCO Keypoints val2017](https://cocodataset.org) 数据集上的结果。 <br>通过 `yolo val pose data=coco-pose.yaml device=0` 复现
191
+ - **速度** 是使用 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例对 COCO val 图像进行平均计算的。 <br>通过 `yolo val pose data=coco-pose.yaml batch=1 device=0|cpu` 复现
192
+
193
+ </details>
194
+
195
+ <details><summary>旋转检测 (DOTAv1)</summary>
196
+
197
+ 查看[旋转检测文档](https://docs.ultralytics.com/tasks/obb/)以获取这些在[DOTAv1](https://docs.ultralytics.com/datasets/obb/dota-v2/#dota-v10/)上训练的模型的使用示例,其中包括15个预训练类别。
198
+
199
+ | 模型 | 尺寸<br><sup>(像素) | mAP<sup>test<br>50 | 速度<br><sup>CPU ONNX<br>(ms) | 速度<br><sup>A100 TensorRT<br>(ms) | 参数<br><sup>(M) | FLOPs<br><sup>(B) |
200
+ | -------------------------------------------------------------------------------------------- | ------------------- | ------------------ | ----------------------------- | ---------------------------------- | ---------------- | ----------------- |
201
+ | [YOLOv8n-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-obb.pt) | 1024 | 78.0 | 204.77 | 3.57 | 3.1 | 23.3 |
202
+ | [YOLOv8s-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-obb.pt) | 1024 | 79.5 | 424.88 | 4.07 | 11.4 | 76.3 |
203
+ | [YOLOv8m-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-obb.pt) | 1024 | 80.5 | 763.48 | 7.61 | 26.4 | 208.6 |
204
+ | [YOLOv8l-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-obb.pt) | 1024 | 80.7 | 1278.42 | 11.83 | 44.5 | 433.8 |
205
+ | [YOLOv8x-obb](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-obb.pt) | 1024 | 81.36 | 1759.10 | 13.23 | 69.5 | 676.7 |
206
+
207
+ - **mAP<sup>val</sup>** 值是基于单模型多尺度在 [DOTAv1](https://captain-whu.github.io/DOTA/index.html) 数据集上的结果。 <br>通过 `yolo val obb data=DOTAv1.yaml device=0 split=test` 复现
208
+ - **速度** 是使用 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例对 COCO val 图像进行平均计算的。 <br>通过 `yolo val obb data=DOTAv1.yaml batch=1 device=0|cpu` 复现
209
+
210
+ </details>
211
+
212
+ <details><summary>分类 (ImageNet)</summary>
213
+
214
+ 查看[分类文档](https://docs.ultralytics.com/tasks/classify/)以获取这些在[ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/)上训练的模型的使用示例,其中包括1000个预训练类别。
215
+
216
+ | 模型 | 尺寸<br><sup>(像素) | acc<br><sup>top1 | acc<br><sup>top5 | 速度<br><sup>CPU ONNX<br>(ms) | 速度<br><sup>A100 TensorRT<br>(ms) | 参数<br><sup>(M) | FLOPs<br><sup>(B) at 640 |
217
+ | -------------------------------------------------------------------------------------------- | ------------------- | ---------------- | ---------------- | ----------------------------- | ---------------------------------- | ---------------- | ------------------------ |
218
+ | [YOLOv8n-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-cls.pt) | 224 | 69.0 | 88.3 | 12.9 | 0.31 | 2.7 | 4.3 |
219
+ | [YOLOv8s-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-cls.pt) | 224 | 73.8 | 91.7 | 23.4 | 0.35 | 6.4 | 13.5 |
220
+ | [YOLOv8m-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-cls.pt) | 224 | 76.8 | 93.5 | 85.4 | 0.62 | 17.0 | 42.7 |
221
+ | [YOLOv8l-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-cls.pt) | 224 | 78.3 | 94.2 | 163.0 | 0.87 | 37.5 | 99.7 |
222
+ | [YOLOv8x-cls](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-cls.pt) | 224 | 79.0 | 94.6 | 232.0 | 1.01 | 57.4 | 154.8 |
223
+
224
+ - **acc** 值是模型在 [ImageNet](https://www.image-net.org/) 数据集验证集上的准确率。 <br>通过 `yolo val classify data=path/to/ImageNet device=0` 复现
225
+ - **速度** 是使用 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例对 ImageNet val 图像进行平均计算的。 <br>通过 `yolo val classify data=path/to/ImageNet batch=1 device=0|cpu` 复现
226
+
227
+ </details>
228
+
229
+ ## <div align="center">集成</div>
230
+
231
+ 我们与领先的AI平台的关键整合扩展了Ultralytics产品的功能,增强了数据集标签化、训练、可视化和模型管理等任务。探索Ultralytics如何与[Roboflow](https://roboflow.com/?ref=ultralytics)、ClearML、[Comet](https://bit.ly/yolov8-readme-comet)、Neural Magic以及[OpenVINO](https://docs.ultralytics.com/integrations/openvino)合作,优化您的AI工作流程。
232
+
233
+ <br>
234
+ <a href="https://ultralytics.com/hub" target="_blank">
235
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png" alt="Ultralytics active learning integrations"></a>
236
+ <br>
237
+ <br>
238
+
239
+ <div align="center">
240
+ <a href="https://roboflow.com/?ref=ultralytics">
241
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-roboflow.png" width="10%" alt="Roboflow logo"></a>
242
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
243
+ <a href="https://clear.ml/">
244
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-clearml.png" width="10%" alt="ClearML logo"></a>
245
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
246
+ <a href="https://bit.ly/yolov8-readme-comet">
247
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-comet.png" width="10%" alt="Comet ML logo"></a>
248
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
249
+ <a href="https://bit.ly/yolov5-neuralmagic">
250
+ <img src="https://github.com/ultralytics/assets/raw/main/partners/logo-neuralmagic.png" width="10%" alt="NeuralMagic logo"></a>
251
+ </div>
252
+
253
+ | Roboflow | ClearML ⭐ NEW | Comet ⭐ NEW | Neural Magic ⭐ NEW |
254
+ | :-------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |
255
+ | 使用 [Roboflow](https://roboflow.com/?ref=ultralytics) 将您的自定义数据集直接标记并导出至 YOLOv8 进行训练 | 使用 [ClearML](https://clear.ml/)(开源!)自动跟踪、可视化,甚至远程训练 YOLOv8 | 免费且永久,[Comet](https://bit.ly/yolov8-readme-comet) 让您保存 YOLOv8 模型、恢复训练,并以交互式方式查看和调试预测 | 使用 [Neural Magic DeepSparse](https://bit.ly/yolov5-neuralmagic) 使 YOLOv8 推理速度提高多达 6 倍 |
256
+
257
+ ## <div align="center">Ultralytics HUB</div>
258
+
259
+ 体验 [Ultralytics HUB](https://ultralytics.com/hub) ⭐ 带来的无缝 AI,这是一个一体化解决方案,用于数据可视化、YOLOv5 和即将推出的 YOLOv8 🚀 模型训练和部署,无需任何编码。通过我们先进的平台和用户友好的 [Ultralytics 应用程序](https://ultralytics.com/app_install),轻松将图像转化为可操作的见解,并实现您的 AI 愿景。现在就开始您的**免费**之旅!
260
+
261
+ <a href="https://ultralytics.com/hub" target="_blank">
262
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/ultralytics-hub.png" alt="Ultralytics HUB preview image"></a>
263
+
264
+ ## <div align="center">贡献</div>
265
+
266
+ 我们喜欢您的参与!没有社区的帮助,YOLOv5 和 YOLOv8 将无法实现。请参阅我们的[贡献指南](https://docs.ultralytics.com/help/contributing)以开始使用,并填写我们的[调查问卷](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey)向我们提供您的使用体验反馈。感谢所有贡献者的支持!🙏
267
+
268
+ <!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
269
+
270
+ <a href="https://github.com/ultralytics/ultralytics/graphs/contributors">
271
+ <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/image-contributors.png" alt="Ultralytics open-source contributors"></a>
272
+
273
+ ## <div align="center">许可证</div>
274
+
275
+ Ultralytics 提供两种许可证选项以适应各种使用场景:
276
+
277
+ - **AGPL-3.0 许可证**:这个[OSI 批准](https://opensource.org/licenses/)的开源许可证非常适合学生和爱好者,可以推动开放的协作和知识分享。请查看[LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) 文件以了解更多细节。
278
+ - **企业许可证**:专为商业用途设计,该许可证允许将 Ultralytics 的软件和 AI 模型无缝集成到商业产品和服务中,从而绕过 AGPL-3.0 的开源要求。如果您的场景涉及将我们的解决方案嵌入到商业产品中,请通过 [Ultralytics Licensing](https://ultralytics.com/license)与我们联系。
279
+
280
+ ## <div align="center">联系方式</div>
281
+
282
+ 对于 Ultralytics 的错误报告和功能请求,请访问 [GitHub Issues](https://github.com/ultralytics/ultralytics/issues),并加入我们的 [Discord](https://ultralytics.com/discord) 社区进行问题和讨论!
283
+
284
+ <br>
285
+ <div align="center">
286
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
287
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
288
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
289
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
290
+ <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
291
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
292
+ <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
293
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
294
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
295
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
296
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
297
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
298
+ <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
299
+ </div>
ultralytics/docker/Dockerfile ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference
4
+
5
+ # Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:23.03-py3
6
+ FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
7
+
8
+ # Set environment variables
9
+ # Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library" https://github.com/pytorch/pytorch/issues/37377
10
+ ENV PYTHONUNBUFFERED=1 \
11
+ PYTHONDONTWRITEBYTECODE=1 \
12
+ PIP_NO_CACHE_DIR=1 \
13
+ PIP_BREAK_SYSTEM_PACKAGES=1 \
14
+ MKL_THREADING_LAYER=GNU
15
+
16
+ # Downloads to user config dir
17
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
18
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
19
+ /root/.config/Ultralytics/
20
+
21
+ # Install linux packages
22
+ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
23
+ # libsm6 required by libqxcb to create QT-based windows for visualization; set 'QT_DEBUG_PLUGINS=1' to test in docker
24
+ RUN apt update \
25
+ && apt install --no-install-recommends -y gcc git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 libsm6
26
+
27
+ # Security updates
28
+ # https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
29
+ RUN apt upgrade --no-install-recommends -y openssl tar
30
+
31
+ # Create working directory
32
+ WORKDIR /ultralytics
33
+
34
+ # Copy contents and configure git
35
+ COPY . .
36
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
37
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
38
+
39
+ # Install pip packages
40
+ RUN python3 -m pip install --upgrade pip wheel
41
+ # Pin TensorRT-cu12==10.1.0 to avoid 10.2.0 bug https://github.com/ultralytics/ultralytics/pull/14239 (note -cu12 must be used)
42
+ RUN pip install -e ".[export]" "tensorrt-cu12==10.1.0" "albumentations>=1.4.6" comet pycocotools
43
+
44
+ # Run exports to AutoInstall packages
45
+ # Edge TPU export fails the first time so is run twice here
46
+ RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32 || yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
47
+ RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
48
+ # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
49
+ RUN pip install "paddlepaddle>=2.6.0" x2paddle
50
+ # Fix error: `np.bool` was a deprecated alias for the builtin `bool` segmentation error in Tests
51
+ RUN pip install numpy==1.23.5
52
+ # Remove exported models
53
+ RUN rm -rf tmp
54
+
55
+
56
+ # Usage Examples -------------------------------------------------------------------------------------------------------
57
+
58
+ # Build and Push
59
+ # t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
60
+
61
+ # Pull and Run with access to all GPUs
62
+ # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
63
+
64
+ # Pull and Run with access to GPUs 2 and 3 (inside container CUDA devices will appear as 0 and 1)
65
+ # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus '"device=2,3"' $t
66
+
67
+ # Pull and Run with local directory access
68
+ # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/shared/datasets:/datasets $t
69
+
70
+ # Kill all
71
+ # sudo docker kill $(sudo docker ps -q)
72
+
73
+ # Kill all image-based
74
+ # sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/ultralytics:latest)
75
+
76
+ # DockerHub tag update
77
+ # t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
78
+
79
+ # Clean up
80
+ # sudo docker system prune -a --volumes
81
+
82
+ # Update Ubuntu drivers
83
+ # https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
84
+
85
+ # DDP test
86
+ # python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
87
+
88
+ # GCP VM from Image
89
+ # docker.io/ultralytics/ultralytics:latest
ultralytics/docker/Dockerfile-arm64 ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest-arm64 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is aarch64-compatible for Apple M1, M2, M3, Raspberry Pi and other ARM architectures
4
+
5
+ # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu with "FROM arm64v8/ubuntu:22.04" (deprecated)
6
+ # Start FROM Debian image for arm64v8 https://hub.docker.com/r/arm64v8/debian (new)
7
+ FROM arm64v8/debian:bookworm-slim
8
+
9
+ # Set environment variables
10
+ ENV PYTHONUNBUFFERED=1 \
11
+ PYTHONDONTWRITEBYTECODE=1 \
12
+ PIP_NO_CACHE_DIR=1 \
13
+ PIP_BREAK_SYSTEM_PACKAGES=1
14
+
15
+ # Downloads to user config dir
16
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
17
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
18
+ /root/.config/Ultralytics/
19
+
20
+ # Install linux packages
21
+ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
22
+ # pkg-config and libhdf5-dev (not included) are needed to build 'h5py==3.11.0' aarch64 wheel required by 'tensorflow'
23
+ RUN apt update \
24
+ && apt install --no-install-recommends -y python3-pip git zip unzip wget curl htop gcc libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
25
+
26
+ # Create working directory
27
+ WORKDIR /ultralytics
28
+
29
+ # Copy contents and configure git
30
+ COPY . .
31
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
32
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
33
+
34
+ # Install pip packages
35
+ RUN python3 -m pip install --upgrade pip wheel
36
+ RUN pip install -e ".[export]"
37
+
38
+ # Creates a symbolic link to make 'python' point to 'python3'
39
+ RUN ln -sf /usr/bin/python3 /usr/bin/python
40
+
41
+
42
+ # Usage Examples -------------------------------------------------------------------------------------------------------
43
+
44
+ # Build and Push
45
+ # t=ultralytics/ultralytics:latest-arm64 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-arm64 -t $t . && sudo docker push $t
46
+
47
+ # Run
48
+ # t=ultralytics/ultralytics:latest-arm64 && sudo docker run -it --ipc=host $t
49
+
50
+ # Pull and Run
51
+ # t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host $t
52
+
53
+ # Pull and Run with local volume mounted
54
+ # t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
ultralytics/docker/Dockerfile-conda ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest-conda image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is optimized for Ultralytics Anaconda (https://anaconda.org/conda-forge/ultralytics) installation and usage
4
+
5
+ # Start FROM miniconda3 image https://hub.docker.com/r/continuumio/miniconda3
6
+ FROM continuumio/miniconda3:latest
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1
13
+
14
+ # Downloads to user config dir
15
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
16
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
17
+ /root/.config/Ultralytics/
18
+
19
+ # Install linux packages
20
+ RUN apt update \
21
+ && apt install --no-install-recommends -y libgl1
22
+
23
+ # Copy contents
24
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
25
+
26
+ # Install conda packages
27
+ # mkl required to fix 'OSError: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory'
28
+ RUN conda config --set solver libmamba && \
29
+ conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia && \
30
+ conda install -c conda-forge ultralytics mkl
31
+ # conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=12.1 ultralytics mkl
32
+
33
+
34
+ # Usage Examples -------------------------------------------------------------------------------------------------------
35
+
36
+ # Build and Push
37
+ # t=ultralytics/ultralytics:latest-conda && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t
38
+
39
+ # Run
40
+ # t=ultralytics/ultralytics:latest-conda && sudo docker run -it --ipc=host $t
41
+
42
+ # Pull and Run
43
+ # t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host $t
44
+
45
+ # Pull and Run with local volume mounted
46
+ # t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
ultralytics/docker/Dockerfile-cpu ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments
4
+
5
+ # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
6
+ FROM ubuntu:23.10
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1
13
+
14
+ # Downloads to user config dir
15
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
16
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
17
+ /root/.config/Ultralytics/
18
+
19
+ # Install linux packages
20
+ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
21
+ RUN apt update \
22
+ && apt install --no-install-recommends -y python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
23
+
24
+ # Create working directory
25
+ WORKDIR /ultralytics
26
+
27
+ # Copy contents and configure git
28
+ COPY . .
29
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
30
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
31
+
32
+ # Install pip packages
33
+ RUN python3 -m pip install --upgrade pip wheel
34
+ RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
35
+
36
+ # Run exports to AutoInstall packages
37
+ RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
38
+ RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
39
+ # Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
40
+ # RUN pip install "paddlepaddle>=2.6.0" x2paddle
41
+ # Remove exported models
42
+ RUN rm -rf tmp
43
+
44
+ # Creates a symbolic link to make 'python' point to 'python3'
45
+ RUN ln -sf /usr/bin/python3 /usr/bin/python
46
+
47
+
48
+ # Usage Examples -------------------------------------------------------------------------------------------------------
49
+
50
+ # Build and Push
51
+ # t=ultralytics/ultralytics:latest-cpu && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t
52
+
53
+ # Run
54
+ # t=ultralytics/ultralytics:latest-cpu && sudo docker run -it --ipc=host --name NAME $t
55
+
56
+ # Pull and Run
57
+ # t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host --name NAME $t
58
+
59
+ # Pull and Run with local volume mounted
60
+ # t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
ultralytics/docker/Dockerfile-jetson-jetpack4 ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:jetson-jetpack4 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Supports JetPack4.x for YOLOv8 on Jetson Nano, TX2, Xavier NX, AGX Xavier
4
+
5
+ # Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-cuda
6
+ FROM nvcr.io/nvidia/l4t-cuda:10.2.460-runtime
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1
11
+
12
+ # Downloads to user config dir
13
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
14
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
15
+ /root/.config/Ultralytics/
16
+
17
+ # Add NVIDIA repositories for TensorRT dependencies
18
+ RUN wget -q -O - https://repo.download.nvidia.com/jetson/jetson-ota-public.asc | apt-key add - && \
19
+ echo "deb https://repo.download.nvidia.com/jetson/common r32.7 main" > /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
20
+ echo "deb https://repo.download.nvidia.com/jetson/t194 r32.7 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
21
+
22
+ # Install dependencies
23
+ RUN apt update && \
24
+ apt install --no-install-recommends -y git python3.8 python3.8-dev python3-pip python3-libnvinfer libopenmpi-dev libopenblas-base libomp-dev gcc
25
+
26
+ # Create symbolic links for python3.8 and pip3
27
+ RUN ln -sf /usr/bin/python3.8 /usr/bin/python3
28
+ RUN ln -s /usr/bin/pip3 /usr/bin/pip
29
+
30
+ # Create working directory
31
+ WORKDIR /ultralytics
32
+
33
+ # Copy contents and configure git
34
+ COPY . .
35
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
36
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
37
+
38
+ # Download onnxruntime-gpu 1.8.0 and tensorrt 8.2.0.6
39
+ # Other versions can be seen in https://elinux.org/Jetson_Zoo and https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
40
+ ADD https://nvidia.box.com/shared/static/gjqofg7rkg97z3gc8jeyup6t8n9j8xjw.whl onnxruntime_gpu-1.8.0-cp38-cp38-linux_aarch64.whl
41
+ ADD https://forums.developer.nvidia.com/uploads/short-url/hASzFOm9YsJx6VVFrDW1g44CMmv.whl tensorrt-8.2.0.6-cp38-none-linux_aarch64.whl
42
+
43
+ # Install pip packages
44
+ RUN python3 -m pip install --upgrade pip wheel
45
+ RUN pip install \
46
+ onnxruntime_gpu-1.8.0-cp38-cp38-linux_aarch64.whl \
47
+ tensorrt-8.2.0.6-cp38-none-linux_aarch64.whl \
48
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-1.11.0a0+gitbc2c6ed-cp38-cp38-linux_aarch64.whl \
49
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.12.0a0+9b5a3fe-cp38-cp38-linux_aarch64.whl
50
+ RUN pip install -e ".[export]"
51
+ RUN rm *.whl
52
+
53
+ # Usage Examples -------------------------------------------------------------------------------------------------------
54
+
55
+ # Build and Push
56
+ # t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack4 -t $t . && sudo docker push $t
57
+
58
+ # Run
59
+ # t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker run -it --ipc=host $t
60
+
61
+ # Pull and Run
62
+ # t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker pull $t && sudo docker run -it --ipc=host $t
63
+
64
+ # Pull and Run with NVIDIA runtime
65
+ # t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
ultralytics/docker/Dockerfile-jetson-jetpack5 ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:jetson-jetson-jetpack5 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Supports JetPack5.x for YOLOv8 on Jetson Xavier NX, AGX Xavier, AGX Orin, Orin Nano and Orin NX
4
+
5
+ # Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-pytorch
6
+ FROM nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1
13
+
14
+ # Downloads to user config dir
15
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
16
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
17
+ /root/.config/Ultralytics/
18
+
19
+ # Install linux packages
20
+ # g++ required to build 'tflite_support' and 'lap' packages
21
+ # libusb-1.0-0 required for 'tflite_support' package when exporting to TFLite
22
+ # pkg-config and libhdf5-dev (not included) are needed to build 'h5py==3.11.0' aarch64 wheel required by 'tensorflow'
23
+ RUN apt update \
24
+ && apt install --no-install-recommends -y gcc git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
25
+
26
+ # Create working directory
27
+ WORKDIR /ultralytics
28
+
29
+ # Copy contents and configure git
30
+ COPY . .
31
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
32
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
33
+
34
+ # Remove opencv-python from Ultralytics dependencies as it conflicts with opencv-python installed in base image
35
+ RUN sed -i '/opencv-python/d' pyproject.toml
36
+
37
+ # Download onnxruntime-gpu 1.15.1 for Jetson Linux 35.2.1 (JetPack 5.1). Other versions can be seen in https://elinux.org/Jetson_Zoo#ONNX_Runtime
38
+ ADD https://nvidia.box.com/shared/static/mvdcltm9ewdy2d5nurkiqorofz1s53ww.whl onnxruntime_gpu-1.15.1-cp38-cp38-linux_aarch64.whl
39
+
40
+ # Install pip packages manually for TensorRT compatibility https://github.com/NVIDIA/TensorRT/issues/2567
41
+ RUN python3 -m pip install --upgrade pip wheel
42
+ RUN pip install onnxruntime_gpu-1.15.1-cp38-cp38-linux_aarch64.whl
43
+ RUN pip install -e ".[export]"
44
+ RUN rm *.whl
45
+
46
+
47
+ # Usage Examples -------------------------------------------------------------------------------------------------------
48
+
49
+ # Build and Push
50
+ # t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack5 -t $t . && sudo docker push $t
51
+
52
+ # Run
53
+ # t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker run -it --ipc=host $t
54
+
55
+ # Pull and Run
56
+ # t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker pull $t && sudo docker run -it --ipc=host $t
57
+
58
+ # Pull and Run with NVIDIA runtime
59
+ # t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
ultralytics/docker/Dockerfile-jetson-jetpack6 ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:jetson-jetpack6 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Supports JetPack6.x for YOLOv8 on Jetson AGX Orin, Orin NX and Orin Nano Series
4
+
5
+ # Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
6
+ FROM nvcr.io/nvidia/l4t-jetpack:r36.3.0
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1
13
+
14
+ # Downloads to user config dir
15
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
16
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
17
+ /root/.config/Ultralytics/
18
+
19
+ # Install dependencies
20
+ RUN apt update && \
21
+ apt install --no-install-recommends -y git python3-pip libopenmpi-dev libopenblas-base libomp-dev
22
+
23
+ # Create working directory
24
+ WORKDIR /ultralytics
25
+
26
+ # Copy contents and configure git
27
+ COPY . .
28
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
29
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
30
+
31
+ # Download onnxruntime-gpu 1.18.0 from https://elinux.org/Jetson_Zoo and https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
32
+ ADD https://nvidia.box.com/shared/static/48dtuob7meiw6ebgfsfqakc9vse62sg4.whl onnxruntime_gpu-1.18.0-cp310-cp310-linux_aarch64.whl
33
+
34
+ # Pip install onnxruntime-gpu, torch, torchvision and ultralytics
35
+ RUN python3 -m pip install --upgrade pip wheel
36
+ RUN pip install \
37
+ onnxruntime_gpu-1.18.0-cp310-cp310-linux_aarch64.whl \
38
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.3.0-cp310-cp310-linux_aarch64.whl \
39
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.18.0a0+6043bc2-cp310-cp310-linux_aarch64.whl
40
+ RUN pip install -e ".[export]"
41
+ RUN rm *.whl
42
+
43
+ # Usage Examples -------------------------------------------------------------------------------------------------------
44
+
45
+ # Build and Push
46
+ # t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack6 -t $t . && sudo docker push $t
47
+
48
+ # Run
49
+ # t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker run -it --ipc=host $t
50
+
51
+ # Pull and Run
52
+ # t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker pull $t && sudo docker run -it --ipc=host $t
53
+
54
+ # Pull and Run with NVIDIA runtime
55
+ # t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
ultralytics/docker/Dockerfile-python ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments
4
+
5
+ # Use the official Python 3.10 slim-bookworm as base image
6
+ FROM python:3.10-slim-bookworm
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1
13
+
14
+ # Downloads to user config dir
15
+ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
16
+ https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
17
+ /root/.config/Ultralytics/
18
+
19
+ # Install linux packages
20
+ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
21
+ RUN apt update \
22
+ && apt install --no-install-recommends -y python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
23
+
24
+ # Create working directory
25
+ WORKDIR /ultralytics
26
+
27
+ # Copy contents and configure git
28
+ COPY . .
29
+ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
30
+ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
31
+
32
+ # Install pip packages
33
+ RUN python3 -m pip install --upgrade pip wheel
34
+ RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
35
+
36
+ # Run exports to AutoInstall packages
37
+ RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
38
+ RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
39
+ # Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
40
+ RUN pip install "paddlepaddle>=2.6.0" x2paddle
41
+ # Remove exported models
42
+ RUN rm -rf tmp
43
+
44
+
45
+ # Usage Examples -------------------------------------------------------------------------------------------------------
46
+
47
+ # Build and Push
48
+ # t=ultralytics/ultralytics:latest-python && sudo docker build -f docker/Dockerfile-python -t $t . && sudo docker push $t
49
+
50
+ # Run
51
+ # t=ultralytics/ultralytics:latest-python && sudo docker run -it --ipc=host $t
52
+
53
+ # Pull and Run
54
+ # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t
55
+
56
+ # Pull and Run with local volume mounted
57
+ # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
ultralytics/docker/Dockerfile-runner ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Builds GitHub actions CI runner image for deployment to DockerHub https://hub.docker.com/r/ultralytics/ultralytics
3
+ # Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference tests
4
+
5
+ # Start FROM Ultralytics GPU image
6
+ FROM ultralytics/ultralytics:latest
7
+
8
+ # Set environment variables
9
+ ENV PYTHONUNBUFFERED=1 \
10
+ PYTHONDONTWRITEBYTECODE=1 \
11
+ PIP_NO_CACHE_DIR=1 \
12
+ PIP_BREAK_SYSTEM_PACKAGES=1 \
13
+ RUNNER_ALLOW_RUNASROOT=1 \
14
+ DEBIAN_FRONTEND=noninteractive
15
+
16
+ # Set the working directory
17
+ WORKDIR /actions-runner
18
+
19
+ # Download and unpack the latest runner from https://github.com/actions/runner
20
+ RUN FILENAME=actions-runner-linux-x64-2.317.0.tar.gz && \
21
+ curl -o $FILENAME -L https://github.com/actions/runner/releases/download/v2.317.0/$FILENAME && \
22
+ tar xzf $FILENAME && \
23
+ rm $FILENAME
24
+
25
+ # Install runner dependencies
26
+ RUN pip install pytest-cov
27
+ RUN ./bin/installdependencies.sh && \
28
+ apt-get -y install libicu-dev
29
+
30
+ # Inline ENTRYPOINT command to configure and start runner with default TOKEN and NAME
31
+ ENTRYPOINT sh -c './config.sh --url https://github.com/ultralytics/ultralytics \
32
+ --token ${GITHUB_RUNNER_TOKEN:-TOKEN} \
33
+ --name ${GITHUB_RUNNER_NAME:-NAME} \
34
+ --labels gpu-latest \
35
+ --replace && \
36
+ ./run.sh'
37
+
38
+
39
+ # Usage Examples -------------------------------------------------------------------------------------------------------
40
+
41
+ # Build and Push
42
+ # t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
43
+
44
+ # Pull and Run in detached mode with access to GPUs 0 and 1
45
+ # t=ultralytics/ultralytics:latest-runner && sudo docker run -d -e GITHUB_RUNNER_TOKEN=TOKEN -e GITHUB_RUNNER_NAME=NAME --ipc=host --gpus '"device=0,1"' $t
ultralytics/docs/README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <br>
2
+ <a href="https://ultralytics.com" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
3
+
4
+ # 📚 Ultralytics Docs
5
+
6
+ [Ultralytics](https://ultralytics.com) Docs are the gateway to understanding and utilizing our cutting-edge machine learning tools. These documents are deployed to [https://docs.ultralytics.com](https://docs.ultralytics.com) for your convenience.
7
+
8
+ [![pages-build-deployment](https://github.com/ultralytics/docs/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/ultralytics/docs/actions/workflows/pages/pages-build-deployment)
9
+ [![Check Broken links](https://github.com/ultralytics/docs/actions/workflows/links.yml/badge.svg)](https://github.com/ultralytics/docs/actions/workflows/links.yml)
10
+ [![Check Domains](https://github.com/ultralytics/docs/actions/workflows/check_domains.yml/badge.svg)](https://github.com/ultralytics/docs/actions/workflows/check_domains.yml)
11
+ [![Ultralytics Actions](https://github.com/ultralytics/docs/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/docs/actions/workflows/format.yml)
12
+ [![Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://ultralytics.com/discord)
13
+ [![Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com)
14
+
15
+ ## 🛠️ Installation
16
+
17
+ [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/)
18
+ [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics)
19
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)
20
+
21
+ To install the ultralytics package in developer mode, ensure you have Git and Python 3 installed on your system. Then, follow these steps:
22
+
23
+ 1. Clone the ultralytics repository to your local machine using Git:
24
+
25
+ ```bash
26
+ git clone https://github.com/ultralytics/ultralytics.git
27
+ ```
28
+
29
+ 2. Navigate to the cloned repository's root directory:
30
+
31
+ ```bash
32
+ cd ultralytics
33
+ ```
34
+
35
+ 3. Install the package in developer mode using pip (or pip3 for Python 3):
36
+
37
+ ```bash
38
+ pip install -e '.[dev]'
39
+ ```
40
+
41
+ - This command installs the ultralytics package along with all development dependencies, allowing you to modify the package code and have the changes immediately reflected in your Python environment.
42
+
43
+ ## 🚀 Building and Serving Locally
44
+
45
+ The `mkdocs serve` command builds and serves a local version of your MkDocs documentation, ideal for development and testing:
46
+
47
+ ```bash
48
+ mkdocs serve
49
+ ```
50
+
51
+ - #### Command Breakdown:
52
+
53
+ - `mkdocs` is the main MkDocs command-line interface.
54
+ - `serve` is the subcommand to build and locally serve your documentation.
55
+
56
+ - 🧐 Note:
57
+
58
+ - Grasp changes to the docs in real-time as `mkdocs serve` supports live reloading.
59
+ - To stop the local server, press `CTRL+C`.
60
+
61
+ ## 🌍 Building and Serving Multi-Language
62
+
63
+ Supporting multi-language documentation? Follow these steps:
64
+
65
+ 1. Stage all new language \*.md files with Git:
66
+
67
+ ```bash
68
+ git add docs/**/*.md -f
69
+ ```
70
+
71
+ 2. Build all languages to the `/site` folder, ensuring relevant root-level files are present:
72
+
73
+ ```bash
74
+ # Clear existing /site directory
75
+ rm -rf site
76
+
77
+ # Loop through each language config file and build
78
+ mkdocs build -f docs/mkdocs.yml
79
+ for file in docs/mkdocs_*.yml; do
80
+ echo "Building MkDocs site with $file"
81
+ mkdocs build -f "$file"
82
+ done
83
+ ```
84
+
85
+ 3. To preview your site, initiate a simple HTTP server:
86
+
87
+ ```bash
88
+ cd site
89
+ python -m http.server
90
+ # Open in your preferred browser
91
+ ```
92
+
93
+ - 🖥️ Access the live site at `http://localhost:8000`.
94
+
95
+ ## 📤 Deploying Your Documentation Site
96
+
97
+ Choose a hosting provider and deployment method for your MkDocs documentation:
98
+
99
+ - Configure `mkdocs.yml` with deployment settings.
100
+ - Use `mkdocs deploy` to build and deploy your site.
101
+
102
+ * ### GitHub Pages Deployment Example:
103
+
104
+ ```bash
105
+ mkdocs gh-deploy
106
+ ```
107
+
108
+ - Update the "Custom domain" in your repository's settings for a personalized URL.
109
+
110
+ ![196814117-fc16e711-d2be-4722-9536-b7c6d78fd167](https://user-images.githubusercontent.com/26833433/210150206-9e86dcd7-10af-43e4-9eb2-9518b3799eac.png)
111
+
112
+ - For detailed deployment guidance, consult the [MkDocs documentation](https://www.mkdocs.org/user-guide/deploying-your-docs/).
113
+
114
+ ## 💡 Contribute
115
+
116
+ We cherish the community's input as it drives Ultralytics open-source initiatives. Dive into the [Contributing Guide](https://docs.ultralytics.com/help/contributing) and share your thoughts via our [Survey](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A heartfelt thank you 🙏 to each contributor!
117
+
118
+ ![Ultralytics open-source contributors](https://github.com/ultralytics/assets/raw/main/im/image-contributors.png)
119
+
120
+ ## 📜 License
121
+
122
+ Ultralytics Docs presents two licensing options:
123
+
124
+ - **AGPL-3.0 License**: Perfect for academia and open collaboration. Details are in the [LICENSE](https://github.com/ultralytics/docs/blob/main/LICENSE) file.
125
+ - **Enterprise License**: Tailored for commercial usage, offering a seamless blend of Ultralytics technology in your products. Learn more at [Ultralytics Licensing](https://ultralytics.com/license).
126
+
127
+ ## ✉️ Contact
128
+
129
+ For bug reports and feature requests, navigate to [GitHub Issues](https://github.com/ultralytics/docs/issues). Engage with peers and the Ultralytics team on [Discord](https://ultralytics.com/discord) for enriching conversations!
130
+
131
+ <br>
132
+ <div align="center">
133
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
134
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
135
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
136
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
137
+ <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
138
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
139
+ <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
140
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
141
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
142
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
143
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
144
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
145
+ <a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
146
+ </div>
ultralytics/docs/build_docs.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ """
3
+ Automates the building and post-processing of MkDocs documentation, particularly for projects with multilingual content.
4
+ It streamlines the workflow for generating localized versions of the documentation and updating HTML links to ensure
5
+ they are correctly formatted.
6
+
7
+ Key Features:
8
+ - Automated building of MkDocs documentation: The script compiles both the main documentation and
9
+ any localized versions specified in separate MkDocs configuration files.
10
+ - Post-processing of generated HTML files: After the documentation is built, the script updates all
11
+ HTML files to remove the '.md' extension from internal links. This ensures that links in the built
12
+ HTML documentation correctly point to other HTML pages rather than Markdown files, which is crucial
13
+ for proper navigation within the web-based documentation.
14
+
15
+ Usage:
16
+ - Run the script from the root directory of your MkDocs project.
17
+ - Ensure that MkDocs is installed and that all MkDocs configuration files (main and localized versions)
18
+ are present in the project directory.
19
+ - The script first builds the documentation using MkDocs, then scans the generated HTML files in the 'site'
20
+ directory to update the internal links.
21
+ - It's ideal for projects where the documentation is written in Markdown and needs to be served as a static website.
22
+
23
+ Note:
24
+ - This script is built to be run in an environment where Python and MkDocs are installed and properly configured.
25
+ """
26
+
27
+ import os
28
+ import re
29
+ import shutil
30
+ import subprocess
31
+ from pathlib import Path
32
+
33
+ from bs4 import BeautifulSoup
34
+ from tqdm import tqdm
35
+
36
+ os.environ["JUPYTER_PLATFORM_DIRS"] = "1" # fix DeprecationWarning: Jupyter is migrating to use standard platformdirs
37
+ DOCS = Path(__file__).parent.resolve()
38
+ SITE = DOCS.parent / "site"
39
+
40
+
41
+ def prepare_docs_markdown(clone_repos=True):
42
+ """Build docs using mkdocs."""
43
+ if SITE.exists():
44
+ print(f"Removing existing {SITE}")
45
+ shutil.rmtree(SITE)
46
+
47
+ # Get hub-sdk repo
48
+ if clone_repos:
49
+ repo = "https://github.com/ultralytics/hub-sdk"
50
+ local_dir = DOCS.parent / Path(repo).name
51
+ if not local_dir.exists():
52
+ os.system(f"git clone {repo} {local_dir}")
53
+ os.system(f"git -C {local_dir} pull") # update repo
54
+ shutil.rmtree(DOCS / "en/hub/sdk", ignore_errors=True) # delete if exists
55
+ shutil.copytree(local_dir / "docs", DOCS / "en/hub/sdk") # for docs
56
+ shutil.rmtree(DOCS.parent / "hub_sdk", ignore_errors=True) # delete if exists
57
+ shutil.copytree(local_dir / "hub_sdk", DOCS.parent / "hub_sdk") # for mkdocstrings
58
+ print(f"Cloned/Updated {repo} in {local_dir}")
59
+
60
+ # Add frontmatter
61
+ for file in tqdm((DOCS / "en").rglob("*.md"), desc="Adding frontmatter"):
62
+ update_markdown_files(file)
63
+
64
+
65
+ def update_page_title(file_path: Path, new_title: str):
66
+ """Update the title of an HTML file."""
67
+ # Read the content of the file
68
+ with open(file_path, encoding="utf-8") as file:
69
+ content = file.read()
70
+
71
+ # Replace the existing title with the new title
72
+ updated_content = re.sub(r"<title>.*?</title>", f"<title>{new_title}</title>", content)
73
+
74
+ # Write the updated content back to the file
75
+ with open(file_path, "w", encoding="utf-8") as file:
76
+ file.write(updated_content)
77
+
78
+
79
+ def update_html_head(script=""):
80
+ """Update the HTML head section of each file."""
81
+ html_files = Path(SITE).rglob("*.html")
82
+ for html_file in tqdm(html_files, desc="Processing HTML files"):
83
+ with html_file.open("r", encoding="utf-8") as file:
84
+ html_content = file.read()
85
+
86
+ if script in html_content: # script already in HTML file
87
+ return
88
+
89
+ head_end_index = html_content.lower().rfind("</head>")
90
+ if head_end_index != -1:
91
+ # Add the specified JavaScript to the HTML file just before the end of the head tag.
92
+ new_html_content = html_content[:head_end_index] + script + html_content[head_end_index:]
93
+ with html_file.open("w", encoding="utf-8") as file:
94
+ file.write(new_html_content)
95
+
96
+
97
+ def update_subdir_edit_links(subdir="", docs_url=""):
98
+ """Update the HTML head section of each file."""
99
+ if str(subdir[0]) == "/":
100
+ subdir = str(subdir[0])[1:]
101
+ html_files = (SITE / subdir).rglob("*.html")
102
+ for html_file in tqdm(html_files, desc="Processing subdir files"):
103
+ with html_file.open("r", encoding="utf-8") as file:
104
+ soup = BeautifulSoup(file, "html.parser")
105
+
106
+ # Find the anchor tag and update its href attribute
107
+ a_tag = soup.find("a", {"class": "md-content__button md-icon"})
108
+ if a_tag and a_tag["title"] == "Edit this page":
109
+ a_tag["href"] = f"{docs_url}{a_tag['href'].split(subdir)[-1]}"
110
+
111
+ # Write the updated HTML back to the file
112
+ with open(html_file, "w", encoding="utf-8") as file:
113
+ file.write(str(soup))
114
+
115
+
116
+ def update_markdown_files(md_filepath: Path):
117
+ """Creates or updates a Markdown file, ensuring frontmatter is present."""
118
+ if md_filepath.exists():
119
+ content = md_filepath.read_text().strip()
120
+
121
+ # Replace apostrophes
122
+ content = content.replace("‘", "'").replace("’", "'")
123
+
124
+ # Add frontmatter if missing
125
+ if not content.strip().startswith("---\n") and "macros" not in md_filepath.parts: # skip macros directory
126
+ header = "---\ncomments: true\ndescription: TODO ADD DESCRIPTION\nkeywords: TODO ADD KEYWORDS\n---\n\n"
127
+ content = header + content
128
+
129
+ # Ensure MkDocs admonitions "=== " lines are preceded and followed by empty newlines
130
+ lines = content.split("\n")
131
+ new_lines = []
132
+ for i, line in enumerate(lines):
133
+ stripped_line = line.strip()
134
+ if stripped_line.startswith("=== "):
135
+ if i > 0 and new_lines[-1] != "":
136
+ new_lines.append("")
137
+ new_lines.append(line)
138
+ if i < len(lines) - 1 and lines[i + 1].strip() != "":
139
+ new_lines.append("")
140
+ else:
141
+ new_lines.append(line)
142
+ content = "\n".join(new_lines)
143
+
144
+ # Add EOF newline if missing
145
+ if not content.endswith("\n"):
146
+ content += "\n"
147
+
148
+ # Save page
149
+ md_filepath.write_text(content)
150
+ return
151
+
152
+
153
+ def update_docs_html():
154
+ """Updates titles, edit links, head sections, and converts plaintext links in HTML documentation."""
155
+ # Update 404 titles
156
+ update_page_title(SITE / "404.html", new_title="Ultralytics Docs - Not Found")
157
+
158
+ # Update edit links
159
+ update_subdir_edit_links(
160
+ subdir="hub/sdk/", # do not use leading slash
161
+ docs_url="https://github.com/ultralytics/hub-sdk/tree/main/docs/",
162
+ )
163
+
164
+ # Convert plaintext links to HTML hyperlinks
165
+ files_modified = 0
166
+ for html_file in tqdm(SITE.rglob("*.html"), desc="Converting plaintext links"):
167
+ with open(html_file, "r", encoding="utf-8") as file:
168
+ content = file.read()
169
+ updated_content = convert_plaintext_links_to_html(content)
170
+ if updated_content != content:
171
+ with open(html_file, "w", encoding="utf-8") as file:
172
+ file.write(updated_content)
173
+ files_modified += 1
174
+ print(f"Modified plaintext links in {files_modified} files.")
175
+
176
+ # Update HTML file head section
177
+ script = ""
178
+ if any(script):
179
+ update_html_head(script)
180
+
181
+ # Delete the /macros directory from the built site
182
+ macros_dir = SITE / "macros"
183
+ if macros_dir.exists():
184
+ print(f"Removing /macros directory from site: {macros_dir}")
185
+ shutil.rmtree(macros_dir)
186
+
187
+
188
+ def convert_plaintext_links_to_html(content):
189
+ """Convert plaintext links to HTML hyperlinks in the main content area only."""
190
+ soup = BeautifulSoup(content, "html.parser")
191
+
192
+ # Find the main content area (adjust this selector based on your HTML structure)
193
+ main_content = soup.find("main") or soup.find("div", class_="md-content")
194
+ if not main_content:
195
+ return content # Return original content if main content area not found
196
+
197
+ modified = False
198
+ for paragraph in main_content.find_all(["p", "li"]): # Focus on paragraphs and list items
199
+ for text_node in paragraph.find_all(string=True, recursive=False):
200
+ if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks
201
+ new_text = re.sub(
202
+ r'(https?://[^\s()<>]+(?:\.[^\s()<>]+)+)(?<![.,:;\'"])',
203
+ r'<a href="\1">\1</a>',
204
+ str(text_node),
205
+ )
206
+ if "<a" in new_text:
207
+ new_soup = BeautifulSoup(new_text, "html.parser")
208
+ text_node.replace_with(new_soup)
209
+ modified = True
210
+
211
+ return str(soup) if modified else content
212
+
213
+
214
+ def remove_macros():
215
+ """Removes the /macros directory and related entries in sitemap.xml from the built site."""
216
+ shutil.rmtree(SITE / "macros", ignore_errors=True)
217
+ (SITE / "sitemap.xml.gz").unlink(missing_ok=True)
218
+
219
+ # Process sitemap.xml
220
+ sitemap = SITE / "sitemap.xml"
221
+ lines = sitemap.read_text(encoding="utf-8").splitlines(keepends=True)
222
+
223
+ # Find indices of '/macros/' lines
224
+ macros_indices = [i for i, line in enumerate(lines) if "/macros/" in line]
225
+
226
+ # Create a set of indices to remove (including lines before and after)
227
+ indices_to_remove = set()
228
+ for i in macros_indices:
229
+ indices_to_remove.update(range(i - 1, i + 4)) # i-1, i, i+1, i+2, i+3
230
+
231
+ # Create new list of lines, excluding the ones to remove
232
+ new_lines = [line for i, line in enumerate(lines) if i not in indices_to_remove]
233
+
234
+ # Write the cleaned content back to the file
235
+ sitemap.write_text("".join(new_lines), encoding="utf-8")
236
+
237
+ print(f"Removed {len(macros_indices)} URLs containing '/macros/' from {sitemap}")
238
+
239
+
240
+ def main():
241
+ """Builds docs, updates titles and edit links, and prints local server command."""
242
+ prepare_docs_markdown()
243
+
244
+ # Build the main documentation
245
+ print(f"Building docs from {DOCS}")
246
+ subprocess.run(f"mkdocs build -f {DOCS.parent}/mkdocs.yml --strict", check=True, shell=True)
247
+ remove_macros()
248
+ print(f"Site built at {SITE}")
249
+
250
+ # Update docs HTML pages
251
+ update_docs_html()
252
+
253
+ # Show command to serve built website
254
+ print('Docs built correctly ✅\nServe site at http://localhost:8000 with "python -m http.server --directory site"')
255
+
256
+
257
+ if __name__ == "__main__":
258
+ main()
ultralytics/docs/build_reference.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ """
3
+ Helper file to build Ultralytics Docs reference section. Recursively walks through ultralytics dir and builds an MkDocs
4
+ reference section of *.md files composed of classes and functions, and also creates a nav menu for use in mkdocs.yaml.
5
+
6
+ Note: Must be run from repository root directory. Do not run from docs directory.
7
+ """
8
+
9
+ import re
10
+ import subprocess
11
+ from collections import defaultdict
12
+ from pathlib import Path
13
+
14
+ # Constants
15
+ hub_sdk = False
16
+ if hub_sdk:
17
+ PACKAGE_DIR = Path("/Users/glennjocher/PycharmProjects/hub-sdk/hub_sdk")
18
+ REFERENCE_DIR = PACKAGE_DIR.parent / "docs/reference"
19
+ GITHUB_REPO = "ultralytics/hub-sdk"
20
+ else:
21
+ FILE = Path(__file__).resolve()
22
+ PACKAGE_DIR = FILE.parents[1] / "ultralytics" # i.e. /Users/glennjocher/PycharmProjects/ultralytics/ultralytics
23
+ REFERENCE_DIR = PACKAGE_DIR.parent / "docs/en/reference"
24
+ GITHUB_REPO = "ultralytics/ultralytics"
25
+
26
+
27
+ def extract_classes_and_functions(filepath: Path) -> tuple:
28
+ """Extracts class and function names from a given Python file."""
29
+ content = filepath.read_text()
30
+ class_pattern = r"(?:^|\n)class\s(\w+)(?:\(|:)"
31
+ func_pattern = r"(?:^|\n)def\s(\w+)\("
32
+
33
+ classes = re.findall(class_pattern, content)
34
+ functions = re.findall(func_pattern, content)
35
+
36
+ return classes, functions
37
+
38
+
39
+ def create_markdown(py_filepath: Path, module_path: str, classes: list, functions: list):
40
+ """Creates a Markdown file containing the API reference for the given Python module."""
41
+ md_filepath = py_filepath.with_suffix(".md")
42
+ exists = md_filepath.exists()
43
+
44
+ # Read existing content and keep header content between first two ---
45
+ header_content = ""
46
+ if exists:
47
+ existing_content = md_filepath.read_text()
48
+ header_parts = existing_content.split("---")
49
+ for part in header_parts:
50
+ if "description:" in part or "comments:" in part:
51
+ header_content += f"---{part}---\n\n"
52
+ if not any(header_content):
53
+ header_content = "---\ndescription: TODO ADD DESCRIPTION\nkeywords: TODO ADD KEYWORDS\n---\n\n"
54
+
55
+ module_name = module_path.replace(".__init__", "")
56
+ module_path = module_path.replace(".", "/")
57
+ url = f"https://github.com/{GITHUB_REPO}/blob/main/{module_path}.py"
58
+ edit = f"https://github.com/{GITHUB_REPO}/edit/main/{module_path}.py"
59
+ pretty = url.replace("__init__.py", "\\_\\_init\\_\\_.py") # properly display __init__.py filenames
60
+ title_content = (
61
+ f"# Reference for `{module_path}.py`\n\n"
62
+ f"!!! Note\n\n"
63
+ f" This file is available at [{pretty}]({url}). If you spot a problem please help fix it by [contributing]"
64
+ f"(https://docs.ultralytics.com/help/contributing/) a [Pull Request]({edit}) 🛠️. Thank you 🙏!\n\n"
65
+ )
66
+ md_content = ["<br>\n"] + [f"## ::: {module_name}.{class_name}\n\n<br><br><hr><br>\n" for class_name in classes]
67
+ md_content.extend(f"## ::: {module_name}.{func_name}\n\n<br><br><hr><br>\n" for func_name in functions)
68
+ md_content[-1] = md_content[-1].replace("<hr><br>", "") # remove last horizontal line
69
+ md_content = header_content + title_content + "\n".join(md_content)
70
+ if not md_content.endswith("\n"):
71
+ md_content += "\n"
72
+
73
+ md_filepath.parent.mkdir(parents=True, exist_ok=True)
74
+ md_filepath.write_text(md_content)
75
+
76
+ if not exists:
77
+ # Add new markdown file to the git staging area
78
+ print(f"Created new file '{md_filepath}'")
79
+ subprocess.run(["git", "add", "-f", str(md_filepath)], check=True, cwd=PACKAGE_DIR)
80
+
81
+ return md_filepath.relative_to(PACKAGE_DIR.parent)
82
+
83
+
84
+ def nested_dict() -> defaultdict:
85
+ """Creates and returns a nested defaultdict."""
86
+ return defaultdict(nested_dict)
87
+
88
+
89
+ def sort_nested_dict(d: dict) -> dict:
90
+ """Sorts a nested dictionary recursively."""
91
+ return {key: sort_nested_dict(value) if isinstance(value, dict) else value for key, value in sorted(d.items())}
92
+
93
+
94
+ def create_nav_menu_yaml(nav_items: list, save: bool = False):
95
+ """Creates a YAML file for the navigation menu based on the provided list of items."""
96
+ nav_tree = nested_dict()
97
+
98
+ for item_str in nav_items:
99
+ item = Path(item_str)
100
+ parts = item.parts
101
+ current_level = nav_tree["reference"]
102
+ for part in parts[2:-1]: # skip the first two parts (docs and reference) and the last part (filename)
103
+ current_level = current_level[part]
104
+
105
+ md_file_name = parts[-1].replace(".md", "")
106
+ current_level[md_file_name] = item
107
+
108
+ nav_tree_sorted = sort_nested_dict(nav_tree)
109
+
110
+ def _dict_to_yaml(d, level=0):
111
+ """Converts a nested dictionary to a YAML-formatted string with indentation."""
112
+ yaml_str = ""
113
+ indent = " " * level
114
+ for k, v in d.items():
115
+ if isinstance(v, dict):
116
+ yaml_str += f"{indent}- {k}:\n{_dict_to_yaml(v, level + 1)}"
117
+ else:
118
+ yaml_str += f"{indent}- {k}: {str(v).replace('docs/en/', '')}\n"
119
+ return yaml_str
120
+
121
+ # Print updated YAML reference section
122
+ print("Scan complete, new mkdocs.yaml reference section is:\n\n", _dict_to_yaml(nav_tree_sorted))
123
+
124
+ # Save new YAML reference section
125
+ if save:
126
+ (PACKAGE_DIR.parent / "nav_menu_updated.yml").write_text(_dict_to_yaml(nav_tree_sorted))
127
+
128
+
129
+ def main():
130
+ """Main function to extract class and function names, create Markdown files, and generate a YAML navigation menu."""
131
+ nav_items = []
132
+
133
+ for py_filepath in PACKAGE_DIR.rglob("*.py"):
134
+ classes, functions = extract_classes_and_functions(py_filepath)
135
+
136
+ if classes or functions:
137
+ py_filepath_rel = py_filepath.relative_to(PACKAGE_DIR)
138
+ md_filepath = REFERENCE_DIR / py_filepath_rel
139
+ module_path = f"{PACKAGE_DIR.name}.{py_filepath_rel.with_suffix('').as_posix().replace('/', '.')}"
140
+ md_rel_filepath = create_markdown(md_filepath, module_path, classes, functions)
141
+ nav_items.append(str(md_rel_filepath))
142
+
143
+ create_nav_menu_yaml(nav_items)
144
+
145
+
146
+ if __name__ == "__main__":
147
+ main()
ultralytics/docs/coming_soon_template.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Discover what's next for Ultralytics with our under-construction page, previewing new, groundbreaking AI and ML features coming soon.
3
+ keywords: Ultralytics, coming soon, under construction, new features, AI updates, ML advancements, YOLO, technology preview
4
+ ---
5
+
6
+ # Under Construction 🏗️🌟
7
+
8
+ Welcome to the [Ultralytics](https://ultralytics.com) "Under Construction" page! Here, we're hard at work developing the next generation of AI and ML innovations. This page serves as a teaser for the exciting updates and new features we're eager to share with you!
9
+
10
+ ## Exciting New Features on the Way 🎉
11
+
12
+ - **Innovative Breakthroughs:** Get ready for advanced features and services that will transform your AI and ML experience.
13
+ - **New Horizons:** Anticipate novel products that redefine AI and ML capabilities.
14
+ - **Enhanced Services:** We're upgrading our services for greater efficiency and user-friendliness.
15
+
16
+ ## Stay Updated 🚧
17
+
18
+ This placeholder page is your first stop for upcoming developments. Keep an eye out for:
19
+
20
+ - **Newsletter:** Subscribe [here](https://ultralytics.com/#newsletter) for the latest news.
21
+ - **Social Media:** Follow us [here](https://www.linkedin.com/company/ultralytics) for updates and teasers.
22
+ - **Blog:** Visit our [blog](https://ultralytics.com/blog) for detailed insights.
23
+
24
+ ## We Value Your Input 🗣️
25
+
26
+ Your feedback shapes our future releases. Share your thoughts and suggestions [here](https://ultralytics.com/survey).
27
+
28
+ ## Thank You, Community! 🌍
29
+
30
+ Your [contributions](https://docs.ultralytics.com/help/contributing) inspire our continuous [innovation](https://github.com/ultralytics/ultralytics). Stay tuned for the big reveal of what's next in AI and ML at Ultralytics!
31
+
32
+ ---
33
+
34
+ Excited for what's coming? Bookmark this page and get ready for a transformative AI and ML journey with Ultralytics! 🛠️🤖
ultralytics/docs/en/CNAME ADDED
@@ -0,0 +1 @@
 
 
1
+ docs.ultralytics.com
ultralytics/docs/en/datasets/classify/caltech101.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ comments: true
3
+ description: Explore the widely-used Caltech-101 dataset with 9,000 images across 101 categories. Ideal for object recognition tasks in machine learning and computer vision.
4
+ keywords: Caltech-101, dataset, object recognition, machine learning, computer vision, YOLO, deep learning, research, AI
5
+ ---
6
+
7
+ # Caltech-101 Dataset
8
+
9
+ The [Caltech-101](https://data.caltech.edu/records/mzrjq-6wc02) dataset is a widely used dataset for object recognition tasks, containing around 9,000 images from 101 object categories. The categories were chosen to reflect a variety of real-world objects, and the images themselves were carefully selected and annotated to provide a challenging benchmark for object recognition algorithms.
10
+
11
+ ## Key Features
12
+
13
+ - The Caltech-101 dataset comprises around 9,000 color images divided into 101 categories.
14
+ - The categories encompass a wide variety of objects, including animals, vehicles, household items, and people.
15
+ - The number of images per category varies, with about 40 to 800 images in each category.
16
+ - Images are of variable sizes, with most images being medium resolution.
17
+ - Caltech-101 is widely used for training and testing in the field of machine learning, particularly for object recognition tasks.
18
+
19
+ ## Dataset Structure
20
+
21
+ Unlike many other datasets, the Caltech-101 dataset is not formally split into training and testing sets. Users typically create their own splits based on their specific needs. However, a common practice is to use a random subset of images for training (e.g., 30 images per category) and the remaining images for testing.
22
+
23
+ ## Applications
24
+
25
+ The Caltech-101 dataset is extensively used for training and evaluating deep learning models in object recognition tasks, such as Convolutional Neural Networks (CNNs), Support Vector Machines (SVMs), and various other machine learning algorithms. Its wide variety of categories and high-quality images make it an excellent dataset for research and development in the field of machine learning and computer vision.
26
+
27
+ ## Usage
28
+
29
+ To train a YOLO model on the Caltech-101 dataset for 100 epochs, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
30
+
31
+ !!! Example "Train Example"
32
+
33
+ === "Python"
34
+
35
+ ```python
36
+ from ultralytics import YOLO
37
+
38
+ # Load a model
39
+ model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
40
+
41
+ # Train the model
42
+ results = model.train(data="caltech101", epochs=100, imgsz=416)
43
+ ```
44
+
45
+ === "CLI"
46
+
47
+ ```bash
48
+ # Start training from a pretrained *.pt model
49
+ yolo classify train data=caltech101 model=yolov8n-cls.pt epochs=100 imgsz=416
50
+ ```
51
+
52
+ ## Sample Images and Annotations
53
+
54
+ The Caltech-101 dataset contains high-quality color images of various objects, providing a well-structured dataset for object recognition tasks. Here are some examples of images from the dataset:
55
+
56
+ ![Dataset sample image](https://user-images.githubusercontent.com/26833433/239366386-44171121-b745-4206-9b59-a3be41e16089.png)
57
+
58
+ The example showcases the variety and complexity of the objects in the Caltech-101 dataset, emphasizing the significance of a diverse dataset for training robust object recognition models.
59
+
60
+ ## Citations and Acknowledgments
61
+
62
+ If you use the Caltech-101 dataset in your research or development work, please cite the following paper:
63
+
64
+ !!! Quote ""
65
+
66
+ === "BibTeX"
67
+
68
+ ```bibtex
69
+ @article{fei2007learning,
70
+ title={Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories},
71
+ author={Fei-Fei, Li and Fergus, Rob and Perona, Pietro},
72
+ journal={Computer vision and Image understanding},
73
+ volume={106},
74
+ number={1},
75
+ pages={59--70},
76
+ year={2007},
77
+ publisher={Elsevier}
78
+ }
79
+ ```
80
+
81
+ We would like to acknowledge Li Fei-Fei, Rob Fergus, and Pietro Perona for creating and maintaining the Caltech-101 dataset as a valuable resource for the machine learning and computer vision research community. For more information about the Caltech-101 dataset and its creators, visit the [Caltech-101 dataset website](https://data.caltech.edu/records/mzrjq-6wc02).
82
+
83
+ ## FAQ
84
+
85
+ ### What is the Caltech-101 dataset used for in machine learning?
86
+
87
+ The [Caltech-101](https://data.caltech.edu/records/mzrjq-6wc02) dataset is widely used in machine learning for object recognition tasks. It contains around 9,000 images across 101 categories, providing a challenging benchmark for evaluating object recognition algorithms. Researchers leverage it to train and test models, especially Convolutional Neural Networks (CNNs) and Support Vector Machines (SVMs), in computer vision.
88
+
89
+ ### How can I train an Ultralytics YOLO model on the Caltech-101 dataset?
90
+
91
+ To train an Ultralytics YOLO model on the Caltech-101 dataset, you can use the provided code snippets. For example, to train for 100 epochs:
92
+
93
+ !!! Example "Train Example"
94
+
95
+ === "Python"
96
+
97
+ ```python
98
+ from ultralytics import YOLO
99
+
100
+ # Load a model
101
+ model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
102
+
103
+ # Train the model
104
+ results = model.train(data="caltech101", epochs=100, imgsz=416)
105
+ ```
106
+
107
+ === "CLI"
108
+
109
+ ```bash
110
+ # Start training from a pretrained *.pt model
111
+ yolo classify train data=caltech101 model=yolov8n-cls.pt epochs=100 imgsz=416
112
+ ```
113
+ For more detailed arguments and options, refer to the model [Training](../../modes/train.md) page.
114
+
115
+ ### What are the key features of the Caltech-101 dataset?
116
+
117
+ The Caltech-101 dataset includes:
118
+ - Around 9,000 color images across 101 categories.
119
+ - Categories covering a diverse range of objects, including animals, vehicles, and household items.
120
+ - Variable number of images per category, typically between 40 and 800.
121
+ - Variable image sizes, with most being medium resolution.
122
+
123
+ These features make it an excellent choice for training and evaluating object recognition models in machine learning and computer vision.
124
+
125
+ ### Why should I cite the Caltech-101 dataset in my research?
126
+
127
+ Citing the Caltech-101 dataset in your research acknowledges the creators' contributions and provides a reference for others who might use the dataset. The recommended citation is:
128
+
129
+ !!! Quote ""
130
+
131
+ === "BibTeX"
132
+
133
+ ```bibtex
134
+ @article{fei2007learning,
135
+ title={Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories},
136
+ author={Fei-Fei, Li and Fergus, Rob and Perona, Pietro},
137
+ journal={Computer vision and Image understanding},
138
+ volume={106},
139
+ number={1},
140
+ pages={59--70},
141
+ year={2007},
142
+ publisher={Elsevier}
143
+ }
144
+ ```
145
+ Citing helps in maintaining the integrity of academic work and assists peers in locating the original resource.
146
+
147
+ ### Can I use Ultralytics HUB for training models on the Caltech-101 dataset?
148
+
149
+ Yes, you can use Ultralytics HUB for training models on the Caltech-101 dataset. Ultralytics HUB provides an intuitive platform for managing datasets, training models, and deploying them without extensive coding. For a detailed guide, refer to the [how to train your custom models with Ultralytics HUB](https://www.ultralytics.com/blog/how-to-train-your-custom-models-with-ultralytics-hub) blog post.