galatasaray commited on
Commit
d152ffd
β€’
1 Parent(s): 71496cd

Add application file

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. Gradio.ipynb +1 -0
  2. datasets/bus.jpg +0 -0
  3. datasets/s1000/s1000 (1).jpg +0 -0
  4. datasets/s1000/s1000 (2).jpg +0 -0
  5. datasets/s1000/s1000 (3).jpg +0 -0
  6. datasets/s1000/s1000 (4).jpg +0 -0
  7. datasets/s1000/s1000 (5).jpg +0 -0
  8. datasets/zidane.jpg +0 -0
  9. saved_model/s1000_best.pt +3 -0
  10. saved_model/yolov5s.pt +3 -0
  11. yolov5/.gitattributes +2 -0
  12. yolov5/.github/CODE_OF_CONDUCT.md +128 -0
  13. yolov5/.github/ISSUE_TEMPLATE/bug-report.yml +85 -0
  14. yolov5/.github/ISSUE_TEMPLATE/config.yml +8 -0
  15. yolov5/.github/ISSUE_TEMPLATE/feature-request.yml +50 -0
  16. yolov5/.github/ISSUE_TEMPLATE/question.yml +33 -0
  17. yolov5/.github/PULL_REQUEST_TEMPLATE.md +9 -0
  18. yolov5/.github/SECURITY.md +7 -0
  19. yolov5/.github/dependabot.yml +23 -0
  20. yolov5/.github/workflows/ci-testing.yml +121 -0
  21. yolov5/.github/workflows/codeql-analysis.yml +54 -0
  22. yolov5/.github/workflows/docker.yml +54 -0
  23. yolov5/.github/workflows/greetings.yml +63 -0
  24. yolov5/.github/workflows/rebase.yml +21 -0
  25. yolov5/.github/workflows/stale.yml +38 -0
  26. yolov5/.gitignore +256 -0
  27. yolov5/.pre-commit-config.yaml +67 -0
  28. yolov5/7.1.2 +1 -0
  29. yolov5/CONTRIBUTING.md +98 -0
  30. yolov5/LICENSE +674 -0
  31. yolov5/README.md +300 -0
  32. yolov5/data/Argoverse.yaml +67 -0
  33. yolov5/data/GlobalWheat2020.yaml +54 -0
  34. yolov5/data/Objects365.yaml +114 -0
  35. yolov5/data/SKU-110K.yaml +53 -0
  36. yolov5/data/VOC.yaml +81 -0
  37. yolov5/data/VisDrone.yaml +61 -0
  38. yolov5/data/coco.yaml +45 -0
  39. yolov5/data/coco128.yaml +30 -0
  40. yolov5/data/hyps/hyp.Objects365.yaml +34 -0
  41. yolov5/data/hyps/hyp.VOC.yaml +40 -0
  42. yolov5/data/hyps/hyp.scratch-high.yaml +34 -0
  43. yolov5/data/hyps/hyp.scratch-low.yaml +34 -0
  44. yolov5/data/hyps/hyp.scratch-med.yaml +34 -0
  45. yolov5/data/images/bus.jpg +0 -0
  46. yolov5/data/images/zidane.jpg +0 -0
  47. yolov5/data/scripts/download_weights.sh +20 -0
  48. yolov5/data/scripts/get_coco.sh +27 -0
  49. yolov5/data/scripts/get_coco128.sh +17 -0
  50. yolov5/data/xView.yaml +102 -0
Gradio.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Gradio.ipynb","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyMP5m/oK5+rqNLpzprjWgfY"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"68CgGISA0OQu","executionInfo":{"status":"ok","timestamp":1657789122929,"user_tz":-180,"elapsed":20255,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"de975cdf-9dd8-4454-f587-bf831c035834"},"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","source":["!ls \"/content/drive/My Drive/Colab Notebooks/Model Representation/\"\n","%cd drive/My Drive/Colab Notebooks/Model Representation/"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"NN8c3dXt0hfN","executionInfo":{"status":"ok","timestamp":1657789124086,"user_tz":-180,"elapsed":1161,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"0626aab3-f0ea-439e-f487-2c704b22a575"},"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["datasets flagged Gradio.ipynb saved_model yolov5\n","/content/drive/My Drive/Colab Notebooks/Model Representation\n"]}]},{"cell_type":"code","source":["import os\n","cwd = os.getcwd()\n","cwd"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":35},"id":"vN36F7c50mF4","executionInfo":{"status":"ok","timestamp":1657789124087,"user_tz":-180,"elapsed":11,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"85d491ab-1f37-40bd-f344-0ca02e38065c"},"execution_count":3,"outputs":[{"output_type":"execute_result","data":{"text/plain":["'/content/drive/My Drive/Colab Notebooks/Model Representation'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":3}]},{"cell_type":"code","source":["!pip install -qr https://raw.githubusercontent.com/ultralytics/yolov5/master/requirements.txt gradio # install dependencies"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"8xT1CQBM1Afx","executionInfo":{"status":"ok","timestamp":1657789272147,"user_tz":-180,"elapsed":148069,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"f45c871a-7627-45c3-c529-aca081b2253d"},"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.1 MB 4.3 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 596 kB 45.0 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 750.6 MB 11 kB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 21.0 MB 1.3 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 57 kB 4.5 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 54 kB 3.0 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 212 kB 59.8 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2.3 MB 44.1 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.1 MB 50.8 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 84 kB 2.7 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 140 kB 58.8 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 272 kB 43.8 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 84 kB 2.9 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 94 kB 2.9 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 144 kB 47.4 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 271 kB 41.4 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 63 kB 1.8 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 80 kB 8.1 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68 kB 6.1 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 54 kB 2.9 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 43 kB 2.1 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 62 kB 804 kB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 856 kB 59.3 MB/s \n","\u001b[K |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.1 MB 42.2 MB/s \n","\u001b[?25h Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Building wheel for python-multipart (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","torchtext 0.13.0 requires torch==1.12.0, but you have torch 1.11.0 which is incompatible.\n","torchaudio 0.12.0+cu113 requires torch==1.12.0, but you have torch 1.11.0 which is incompatible.\u001b[0m\n"]}]},{"cell_type":"code","source":["import gradio as gr\n","import torch\n","from PIL import Image\n","\n","# Images\n","#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')\n","#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/bus.jpg', 'bus.jpg')\n","\n","# Model\n","#model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update\n","\n","model = torch.hub.load(cwd+'/yolov5', 'custom', path=cwd+'/saved_model/yolov5s.pt', source='local') # local model\n","\n","\n","\n","def yolo(im, size=640):\n"," g = (size / max(im.size)) # gain\n"," im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize\n","\n"," results = model(im) # inference\n"," results.render() # updates results.imgs with boxes and labels\n"," return Image.fromarray(results.imgs[0])\n","\n","\n","inputs = gr.inputs.Image(type='pil', label=\"Original Image\")\n","outputs = gr.outputs.Image(type=\"pil\", label=\"Output Image\")\n","\n","title = \"YOLOv5\"\n","description = \"YOLOv5 Gradio demo for object detection. Upload an image or click an example image to use.\"\n","article = \"<p style='text-align: center'>YOLOv5 is a family of compound-scaled object detection models trained on the COCO dataset, and includes \" \\\n"," \"simple functionality for Test Time Augmentation (TTA), model ensembling, hyperparameter evolution, \" \\\n"," \"and export to ONNX, CoreML and TFLite. <a href='https://github.com/ultralytics/yolov5'>Source code</a> |\" \\\n"," \"<a href='https://apps.apple.com/app/id1452689527'>iOS App</a> | <a href='https://pytorch.org/hub/ultralytics_yolov5'>PyTorch Hub</a></p>\"\n","\n","examples = [[cwd+'/datasets/zidane.jpg'], [cwd+'/datasets/bus.jpg']]\n","gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, analytics_enabled=False).launch(\n"," debug=True)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"FwCb9Nmk1n6n","executionInfo":{"status":"ok","timestamp":1657788661371,"user_tz":-180,"elapsed":223749,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"219fa614-9dda-4870-fe54-dfce5b4e4b05"},"execution_count":10,"outputs":[{"output_type":"stream","name":"stderr","text":["\u001b[31m\u001b[1mrequirements:\u001b[0m PyYAML>=5.3.1 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: PyYAML>=5.3.1 in /usr/local/lib/python3.7/dist-packages (6.0)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m torch!=1.12.0,>=1.7.0 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: torch!=1.12.0,>=1.7.0 in /usr/local/lib/python3.7/dist-packages (1.11.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch!=1.12.0,>=1.7.0) (4.1.1)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m torchvision!=0.13.0,>=0.8.1 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: torchvision!=0.13.0,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (0.12.0)\n","Requirement already satisfied: torch==1.11.0 in /usr/local/lib/python3.7/dist-packages (from torchvision!=0.13.0,>=0.8.1) (1.11.0)\n","Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.7/dist-packages (from torchvision!=0.13.0,>=0.8.1) (7.1.2)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from torchvision!=0.13.0,>=0.8.1) (2.23.0)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from torchvision!=0.13.0,>=0.8.1) (1.21.6)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torchvision!=0.13.0,>=0.8.1) (4.1.1)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision!=0.13.0,>=0.8.1) (3.0.4)\n","Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision!=0.13.0,>=0.8.1) (1.24.3)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision!=0.13.0,>=0.8.1) (2022.6.15)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision!=0.13.0,>=0.8.1) (2.10)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m 3 packages updated per /root/.cache/torch/hub/ultralytics_yolov5_master/requirements.txt\n","\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n","\n","YOLOv5 πŸš€ 2022-7-14 Python-3.7.13 torch-1.11.0+cu102 CPU\n","\n","Fusing layers... \n","YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients\n","Adding AutoShape... \n","/usr/local/lib/python3.7/dist-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n"," warnings.warn(value)\n"]},{"output_type":"stream","name":"stdout","text":["Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch().\n"]},{"output_type":"stream","name":"stderr","text":["Connected (version 2.0, client OpenSSH_7.6p1)\n","Authentication (publickey) successful!\n"]},{"output_type":"stream","name":"stdout","text":["Running on public URL: https://21879.gradio.app\n","\n","This share link expires in 72 hours. For free permanent hosting, check out Spaces (https://huggingface.co/spaces)\n"]},{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.HTML object>"],"text/html":["<div><iframe src=\"https://21879.gradio.app\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"]},"metadata":{}},{"output_type":"stream","name":"stdout","text":["Keyboard interruption in main thread... closing server.\n"]},{"output_type":"execute_result","data":{"text/plain":["(<gradio.routes.App at 0x7f39e2421b50>,\n"," 'http://127.0.0.1:7860/',\n"," 'https://21879.gradio.app')"]},"metadata":{},"execution_count":10}]},{"cell_type":"code","source":["import gradio as gr\n","import torch\n","from PIL import Image\n","\n","# Images\n","#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')\n","#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/bus.jpg', 'bus.jpg')\n","\n","# Model\n","#model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update\n","model = torch.hub.load(cwd+'/yolov5', 'custom', path=cwd+'/saved_model/s1000_best.pt', source='local') # local model\n","\n","\n","def yolo(im, size=640):\n"," g = (size / max(im.size)) # gain\n"," im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize\n","\n"," results = model(im) # inference\n"," results.render() # updates results.imgs with boxes and labels\n"," return Image.fromarray(results.imgs[0])\n","\n","\n","inputs = gr.inputs.Image(type='pil', label=\"Original Image\")\n","outputs = gr.outputs.Image(type=\"pil\", label=\"Output Image\")\n","\n","title = \"YOLOv5\"\n","description = \"YOLOv5 Gradio demo for object detection. Upload an image or click an example image to use.\"\n","article = \"<p style='text-align: center'>YOLOv5 is a family of compound-scaled object detection models trained on the COCO dataset, and includes \" \\\n"," \"simple functionality for Test Time Augmentation (TTA), model ensembling, hyperparameter evolution, \" \\\n"," \"and export to ONNX, CoreML and TFLite. <a href='https://github.com/ultralytics/yolov5'>Source code</a> |\" \\\n"," \"<a href='https://apps.apple.com/app/id1452689527'>iOS App</a> | <a href='https://pytorch.org/hub/ultralytics_yolov5'>PyTorch Hub</a></p>\"\n","\n","path_folder = cwd+'/datasets/s1000/'\n","examples = [[path_folder+'s1000 (1).png'], [path_folder+'s1000 (2).png'],[path_folder+'s1000 (3).png'],[path_folder+'s1000 (4).png'],[path_folder+'s1000 (5).png']]\n","gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, analytics_enabled=False).launch(\n"," debug=True)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"8kaOPNyz2cEr","executionInfo":{"status":"ok","timestamp":1657789820492,"user_tz":-180,"elapsed":541032,"user":{"displayName":"orhan ekinci","userId":"08596083551140132378"}},"outputId":"dd0ad238-a602-4bd0-e610-2f523a37d378"},"execution_count":5,"outputs":[{"output_type":"stream","name":"stderr","text":["\u001b[31m\u001b[1mrequirements:\u001b[0m PyYAML>=5.3.1 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: PyYAML>=5.3.1 in /usr/local/lib/python3.7/dist-packages (6.0)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m torch>=1.7.0 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: torch>=1.7.0 in /usr/local/lib/python3.7/dist-packages (1.11.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch>=1.7.0) (4.1.1)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m torchvision>=0.8.1 not found and is required by YOLOv5, attempting auto-update...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: torchvision>=0.8.1 in /usr/local/lib/python3.7/dist-packages (0.12.0)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from torchvision>=0.8.1) (1.21.6)\n","Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.7/dist-packages (from torchvision>=0.8.1) (7.1.2)\n","Requirement already satisfied: torch==1.11.0 in /usr/local/lib/python3.7/dist-packages (from torchvision>=0.8.1) (1.11.0)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from torchvision>=0.8.1) (2.23.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torchvision>=0.8.1) (4.1.1)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision>=0.8.1) (2.10)\n","Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision>=0.8.1) (1.24.3)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision>=0.8.1) (3.0.4)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->torchvision>=0.8.1) (2022.6.15)\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m 3 packages updated per /content/drive/My Drive/Colab Notebooks/Model Representation/yolov5/requirements.txt\n","\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n","\n","YOLOv5 πŸš€ 2022-6-24 Python-3.7.13 torch-1.11.0+cu102 CPU\n","\n","Fusing layers... \n","Model summary: 213 layers, 7012822 parameters, 0 gradients\n","Adding AutoShape... \n","/usr/local/lib/python3.7/dist-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n"," warnings.warn(value)\n"]},{"output_type":"stream","name":"stdout","text":["Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch().\n"]},{"output_type":"stream","name":"stderr","text":["Connected (version 2.0, client OpenSSH_7.6p1)\n","Authentication (publickey) successful!\n"]},{"output_type":"stream","name":"stdout","text":["Running on public URL: https://32048.gradio.app\n","\n","This share link expires in 72 hours. For free permanent hosting, check out Spaces (https://huggingface.co/spaces)\n"]},{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.HTML object>"],"text/html":["<div><iframe src=\"https://32048.gradio.app\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"]},"metadata":{}},{"output_type":"stream","name":"stderr","text":["Traceback (most recent call last):\n"," File \"/usr/local/lib/python3.7/dist-packages/gradio/routes.py\", line 256, in run_predict\n"," fn_index, raw_input, username, session_state\n"," File \"/usr/local/lib/python3.7/dist-packages/gradio/blocks.py\", line 548, in process_api\n"," predictions, duration = await self.call_function(fn_index, processed_input)\n"," File \"/usr/local/lib/python3.7/dist-packages/gradio/blocks.py\", line 464, in call_function\n"," block_fn.fn, *processed_input, limiter=self.limiter\n"," File \"/usr/local/lib/python3.7/dist-packages/anyio/to_thread.py\", line 32, in run_sync\n"," func, *args, cancellable=cancellable, limiter=limiter\n"," File \"/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py\", line 937, in run_sync_in_worker_thread\n"," return await future\n"," File \"/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py\", line 867, in run\n"," result = context.run(func, *args)\n"," File \"/usr/local/lib/python3.7/dist-packages/gradio/interface.py\", line 515, in <lambda>\n"," if len(self.output_components) == 1\n"," File \"/usr/local/lib/python3.7/dist-packages/gradio/interface.py\", line 718, in run_prediction\n"," prediction = predict_fn(*processed_input)\n"," File \"<ipython-input-5-7438d39302b1>\", line 15, in yolo\n"," g = (size / max(im.size)) # gain\n","AttributeError: 'NoneType' object has no attribute 'size'\n"]},{"output_type":"stream","name":"stdout","text":["Keyboard interruption in main thread... closing server.\n"]},{"output_type":"execute_result","data":{"text/plain":["(<gradio.routes.App at 0x7f9be15b0ed0>,\n"," 'http://127.0.0.1:7860/',\n"," 'https://32048.gradio.app')"]},"metadata":{},"execution_count":5}]}]}
datasets/bus.jpg ADDED
datasets/s1000/s1000 (1).jpg ADDED
datasets/s1000/s1000 (2).jpg ADDED
datasets/s1000/s1000 (3).jpg ADDED
datasets/s1000/s1000 (4).jpg ADDED
datasets/s1000/s1000 (5).jpg ADDED
datasets/zidane.jpg ADDED
saved_model/s1000_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19c8454fdec99b2a9c7bf2894d3df671f04795ea3b09cd0f02ef09a5110de561
3
+ size 14359221
saved_model/yolov5s.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b3b748c1e592ddd8868022e8732fde20025197328490623cc16c6f24d0782ee
3
+ size 14808437
yolov5/.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # this drop notebooks from GitHub language stats
2
+ *.ipynb linguist-vendored
yolov5/.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ hello@ultralytics.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ https://www.contributor-covenant.org/faq. Translations are available at
126
+ https://www.contributor-covenant.org/translations.
127
+
128
+ [homepage]: https://www.contributor-covenant.org
yolov5/.github/ISSUE_TEMPLATE/bug-report.yml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: πŸ› Bug Report
2
+ # title: " "
3
+ description: Problems with YOLOv5
4
+ labels: [bug, triage]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for submitting a YOLOv5 πŸ› Bug Report!
10
+
11
+ - type: checkboxes
12
+ attributes:
13
+ label: Search before asking
14
+ description: >
15
+ Please search the [issues](https://github.com/ultralytics/yolov5/issues) to see if a similar bug report already exists.
16
+ options:
17
+ - label: >
18
+ I have searched the YOLOv5 [issues](https://github.com/ultralytics/yolov5/issues) and found no similar bug report.
19
+ required: true
20
+
21
+ - type: dropdown
22
+ attributes:
23
+ label: YOLOv5 Component
24
+ description: |
25
+ Please select the part of YOLOv5 where you found the bug.
26
+ multiple: true
27
+ options:
28
+ - "Training"
29
+ - "Validation"
30
+ - "Detection"
31
+ - "Export"
32
+ - "PyTorch Hub"
33
+ - "Multi-GPU"
34
+ - "Evolution"
35
+ - "Integrations"
36
+ - "Other"
37
+ validations:
38
+ required: false
39
+
40
+ - type: textarea
41
+ attributes:
42
+ label: Bug
43
+ description: Provide console output with error messages and/or screenshots of the bug.
44
+ placeholder: |
45
+ πŸ’‘ ProTip! Include as much information as possible (screenshots, logs, tracebacks etc.) to receive the most helpful response.
46
+ validations:
47
+ required: true
48
+
49
+ - type: textarea
50
+ attributes:
51
+ label: Environment
52
+ description: Please specify the software and hardware you used to produce the bug.
53
+ placeholder: |
54
+ - YOLO: YOLOv5 πŸš€ v6.0-67-g60e42e1 torch 1.9.0+cu111 CUDA:0 (A100-SXM4-40GB, 40536MiB)
55
+ - OS: Ubuntu 20.04
56
+ - Python: 3.9.0
57
+ validations:
58
+ required: false
59
+
60
+ - type: textarea
61
+ attributes:
62
+ label: Minimal Reproducible Example
63
+ description: >
64
+ 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.
65
+ This is referred to by community members as creating a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
66
+ placeholder: |
67
+ ```
68
+ # Code to reproduce your issue here
69
+ ```
70
+ validations:
71
+ required: false
72
+
73
+ - type: textarea
74
+ attributes:
75
+ label: Additional
76
+ description: Anything else you would like to share?
77
+
78
+ - type: checkboxes
79
+ attributes:
80
+ label: Are you willing to submit a PR?
81
+ description: >
82
+ (Optional) We encourage you to submit a [Pull Request](https://github.com/ultralytics/yolov5/pulls) (PR) to help improve YOLOv5 for everyone, especially if you have a good understanding of how to implement a fix or feature.
83
+ See the YOLOv5 [Contributing Guide](https://github.com/ultralytics/yolov5/blob/master/CONTRIBUTING.md) to get started.
84
+ options:
85
+ - label: Yes I'd like to help by submitting a PR!
yolov5/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: πŸ’¬ Forum
4
+ url: https://community.ultralytics.com/
5
+ about: Ask on Ultralytics Community Forum
6
+ - name: Stack Overflow
7
+ url: https://stackoverflow.com/search?q=YOLOv5
8
+ about: Ask on Stack Overflow with 'YOLOv5' tag
yolov5/.github/ISSUE_TEMPLATE/feature-request.yml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: πŸš€ Feature Request
2
+ description: Suggest a YOLOv5 idea
3
+ # title: " "
4
+ labels: [enhancement]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for submitting a YOLOv5 πŸš€ Feature Request!
10
+
11
+ - type: checkboxes
12
+ attributes:
13
+ label: Search before asking
14
+ description: >
15
+ Please search the [issues](https://github.com/ultralytics/yolov5/issues) to see if a similar feature request already exists.
16
+ options:
17
+ - label: >
18
+ I have searched the YOLOv5 [issues](https://github.com/ultralytics/yolov5/issues) and found no similar feature requests.
19
+ required: true
20
+
21
+ - type: textarea
22
+ attributes:
23
+ label: Description
24
+ description: A short description of your feature.
25
+ placeholder: |
26
+ What new feature would you like to see in YOLOv5?
27
+ validations:
28
+ required: true
29
+
30
+ - type: textarea
31
+ attributes:
32
+ label: Use case
33
+ description: |
34
+ Describe the use case of your feature request. It will help us understand and prioritize the feature request.
35
+ placeholder: |
36
+ How would this feature be used, and who would use it?
37
+
38
+ - type: textarea
39
+ attributes:
40
+ label: Additional
41
+ description: Anything else you would like to share?
42
+
43
+ - type: checkboxes
44
+ attributes:
45
+ label: Are you willing to submit a PR?
46
+ description: >
47
+ (Optional) We encourage you to submit a [Pull Request](https://github.com/ultralytics/yolov5/pulls) (PR) to help improve YOLOv5 for everyone, especially if you have a good understanding of how to implement a fix or feature.
48
+ See the YOLOv5 [Contributing Guide](https://github.com/ultralytics/yolov5/blob/master/CONTRIBUTING.md) to get started.
49
+ options:
50
+ - label: Yes I'd like to help by submitting a PR!
yolov5/.github/ISSUE_TEMPLATE/question.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ❓ Question
2
+ description: Ask a YOLOv5 question
3
+ # title: " "
4
+ labels: [question]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for asking a YOLOv5 ❓ Question!
10
+
11
+ - type: checkboxes
12
+ attributes:
13
+ label: Search before asking
14
+ description: >
15
+ Please search the [issues](https://github.com/ultralytics/yolov5/issues) and [discussions](https://github.com/ultralytics/yolov5/discussions) to see if a similar question already exists.
16
+ options:
17
+ - label: >
18
+ I have searched the YOLOv5 [issues](https://github.com/ultralytics/yolov5/issues) and [discussions](https://github.com/ultralytics/yolov5/discussions) and found no similar questions.
19
+ required: true
20
+
21
+ - type: textarea
22
+ attributes:
23
+ label: Question
24
+ description: What is your question?
25
+ placeholder: |
26
+ πŸ’‘ ProTip! Include as much information as possible (screenshots, logs, tracebacks etc.) to receive the most helpful response.
27
+ validations:
28
+ required: true
29
+
30
+ - type: textarea
31
+ attributes:
32
+ label: Additional
33
+ description: Anything else you would like to share?
yolov5/.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Thank you for submitting a YOLOv5 πŸš€ Pull Request! We want to make contributing to YOLOv5 as easy and transparent as possible. A few tips to get you started:
3
+
4
+ - Search existing YOLOv5 [PRs](https://github.com/ultralytics/yolov5/pull) to see if a similar PR already exists.
5
+ - Link this PR to a YOLOv5 [issue](https://github.com/ultralytics/yolov5/issues) to help us understand what bug fix or feature is being implemented.
6
+ - Provide before and after profiling/inference/training results to help us quantify the improvement your PR provides (if applicable).
7
+
8
+ Please see our βœ… [Contributing Guide](https://github.com/ultralytics/yolov5/blob/master/CONTRIBUTING.md) for more details.
9
+ -->
yolov5/.github/SECURITY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Security Policy
2
+
3
+ We aim to make YOLOv5 πŸš€ as secure as possible! If you find potential vulnerabilities or have any concerns please let us know so we can investigate and take corrective action if needed.
4
+
5
+ ### Reporting a Vulnerability
6
+
7
+ To report vulnerabilities please email us at hello@ultralytics.com or visit https://ultralytics.com/contact. Thank you!
yolov5/.github/dependabot.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ time: "04:00"
8
+ open-pull-requests-limit: 10
9
+ reviewers:
10
+ - glenn-jocher
11
+ labels:
12
+ - dependencies
13
+
14
+ - package-ecosystem: github-actions
15
+ directory: "/"
16
+ schedule:
17
+ interval: weekly
18
+ time: "04:00"
19
+ open-pull-requests-limit: 5
20
+ reviewers:
21
+ - glenn-jocher
22
+ labels:
23
+ - dependencies
yolov5/.github/workflows/ci-testing.yml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # YOLOv5 Continuous Integration (CI) GitHub Actions tests
3
+
4
+ name: YOLOv5 CI
5
+
6
+ on:
7
+ push:
8
+ branches: [master]
9
+ pull_request:
10
+ branches: [master]
11
+ schedule:
12
+ - cron: '0 0 * * *' # runs at 00:00 UTC every day
13
+
14
+ jobs:
15
+ Benchmarks:
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ matrix:
19
+ os: [ubuntu-latest]
20
+ python-version: [3.9]
21
+ model: [yolov5n]
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - uses: actions/setup-python@v4
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ #- name: Cache pip
28
+ # uses: actions/cache@v3
29
+ # with:
30
+ # path: ~/.cache/pip
31
+ # key: ${{ runner.os }}-Benchmarks-${{ hashFiles('requirements.txt') }}
32
+ # restore-keys: ${{ runner.os }}-Benchmarks-
33
+ - name: Install requirements
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ pip install -r requirements.txt coremltools openvino-dev tensorflow-cpu --extra-index-url https://download.pytorch.org/whl/cpu
37
+ python --version
38
+ pip --version
39
+ pip list
40
+ - name: Run benchmarks
41
+ run: |
42
+ python utils/benchmarks.py --weights ${{ matrix.model }}.pt --img 320
43
+
44
+ Tests:
45
+ timeout-minutes: 60
46
+ runs-on: ${{ matrix.os }}
47
+ strategy:
48
+ fail-fast: false
49
+ matrix:
50
+ os: [ubuntu-latest, macos-latest, windows-latest]
51
+ python-version: [3.9]
52
+ model: [yolov5n]
53
+ include:
54
+ - os: ubuntu-latest
55
+ python-version: '3.7' # '3.6.8' min
56
+ model: yolov5n
57
+ - os: ubuntu-latest
58
+ python-version: '3.8'
59
+ model: yolov5n
60
+ - os: ubuntu-latest
61
+ python-version: '3.10'
62
+ model: yolov5n
63
+ steps:
64
+ - uses: actions/checkout@v3
65
+ - uses: actions/setup-python@v4
66
+ with:
67
+ python-version: ${{ matrix.python-version }}
68
+ - name: Get cache dir
69
+ # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
70
+ id: pip-cache
71
+ run: echo "::set-output name=dir::$(pip cache dir)"
72
+ - name: Cache pip
73
+ uses: actions/cache@v3
74
+ with:
75
+ path: ${{ steps.pip-cache.outputs.dir }}
76
+ key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
77
+ restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-pip-
78
+ - name: Install requirements
79
+ run: |
80
+ python -m pip install --upgrade pip
81
+ pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
82
+ python --version
83
+ pip --version
84
+ pip list
85
+ - name: Check environment
86
+ run: |
87
+ python -c "import utils; utils.notebook_init()"
88
+ echo "RUNNER_OS is $RUNNER_OS"
89
+ echo "GITHUB_EVENT_NAME is $GITHUB_EVENT_NAME"
90
+ echo "GITHUB_WORKFLOW is $GITHUB_WORKFLOW"
91
+ echo "GITHUB_ACTOR is $GITHUB_ACTOR"
92
+ echo "GITHUB_REPOSITORY is $GITHUB_REPOSITORY"
93
+ echo "GITHUB_REPOSITORY_OWNER is $GITHUB_REPOSITORY_OWNER"
94
+ - name: Run tests
95
+ shell: bash
96
+ run: |
97
+ # export PYTHONPATH="$PWD" # to run '$ python *.py' files in subdirectories
98
+ d=cpu # device
99
+ model=${{ matrix.model }}
100
+ best=runs/train/exp/weights/best.pt
101
+ # Train
102
+ python train.py --img 64 --batch 32 --weights $model.pt --cfg $model.yaml --epochs 1 --device $d
103
+ # Val
104
+ python val.py --img 64 --batch 32 --weights $model.pt --device $d
105
+ python val.py --img 64 --batch 32 --weights $best --device $d
106
+ # Detect
107
+ python detect.py --weights $model.pt --device $d
108
+ python detect.py --weights $best --device $d
109
+ python hubconf.py # hub
110
+ # Export
111
+ # python models/tf.py --weights $model.pt # build TF model
112
+ python models/yolo.py --cfg $model.yaml # build PyTorch model
113
+ python export.py --weights $model.pt --img 64 --include torchscript # export
114
+ # Python
115
+ python - <<EOF
116
+ import torch
117
+ model = torch.hub.load('.', 'custom', path='$model', source='local')
118
+ print(model('data/images/bus.jpg'))
119
+ model = torch.hub.load('.', 'custom', path='$best', source='local')
120
+ print(model('data/images/bus.jpg'))
121
+ EOF
yolov5/.github/workflows/codeql-analysis.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This action runs GitHub's industry-leading static analysis engine, CodeQL, against a repository's source code to find security vulnerabilities.
2
+ # https://github.com/github/codeql-action
3
+
4
+ name: "CodeQL"
5
+
6
+ on:
7
+ schedule:
8
+ - cron: '0 0 1 * *' # Runs at 00:00 UTC on the 1st of every month
9
+
10
+ jobs:
11
+ analyze:
12
+ name: Analyze
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ language: ['python']
19
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
20
+ # Learn more:
21
+ # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
22
+
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v3
26
+
27
+ # Initializes the CodeQL tools for scanning.
28
+ - name: Initialize CodeQL
29
+ uses: github/codeql-action/init@v2
30
+ with:
31
+ languages: ${{ matrix.language }}
32
+ # If you wish to specify custom queries, you can do so here or in a config file.
33
+ # By default, queries listed here will override any specified in a config file.
34
+ # Prefix the list here with "+" to use these queries and those in the config file.
35
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
36
+
37
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38
+ # If this step fails, then you should remove it and run the build manually (see below)
39
+ - name: Autobuild
40
+ uses: github/codeql-action/autobuild@v2
41
+
42
+ # ℹ️ Command-line programs to run using the OS shell.
43
+ # πŸ“š https://git.io/JvXDl
44
+
45
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46
+ # and modify them (or add more) to build your code if your project
47
+ # uses a compiled language
48
+
49
+ #- run: |
50
+ # make bootstrap
51
+ # make release
52
+
53
+ - name: Perform CodeQL Analysis
54
+ uses: github/codeql-action/analyze@v2
yolov5/.github/workflows/docker.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Builds ultralytics/yolov5:latest images on DockerHub https://hub.docker.com/r/ultralytics/yolov5
3
+
4
+ name: Publish Docker Images
5
+
6
+ on:
7
+ push:
8
+ branches: [ master ]
9
+
10
+ jobs:
11
+ docker:
12
+ if: github.repository == 'ultralytics/yolov5'
13
+ name: Push Docker image to Docker Hub
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout repo
17
+ uses: actions/checkout@v3
18
+
19
+ - name: Set up QEMU
20
+ uses: docker/setup-qemu-action@v2
21
+
22
+ - name: Set up Docker Buildx
23
+ uses: docker/setup-buildx-action@v2
24
+
25
+ - name: Login to Docker Hub
26
+ uses: docker/login-action@v2
27
+ with:
28
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
29
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
30
+
31
+ - name: Build and push arm64 image
32
+ uses: docker/build-push-action@v3
33
+ with:
34
+ context: .
35
+ platforms: linux/arm64
36
+ file: utils/docker/Dockerfile-arm64
37
+ push: true
38
+ tags: ultralytics/yolov5:latest-arm64
39
+
40
+ - name: Build and push CPU image
41
+ uses: docker/build-push-action@v3
42
+ with:
43
+ context: .
44
+ file: utils/docker/Dockerfile-cpu
45
+ push: true
46
+ tags: ultralytics/yolov5:latest-cpu
47
+
48
+ - name: Build and push GPU image
49
+ uses: docker/build-push-action@v3
50
+ with:
51
+ context: .
52
+ file: utils/docker/Dockerfile
53
+ push: true
54
+ tags: ultralytics/yolov5:latest
yolov5/.github/workflows/greetings.yml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-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 a YOLOv5 πŸš€ PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
20
+ - βœ… Verify your PR is **up-to-date with upstream/master.** If your PR is behind upstream/master an automatic [GitHub Actions](https://github.com/ultralytics/yolov5/blob/master/.github/workflows/rebase.yml) merge may be attempted by writing /rebase in a new comment, or by running the following code, replacing 'feature' with the name of your local branch:
21
+ ```bash
22
+ git remote add upstream https://github.com/ultralytics/yolov5.git
23
+ git fetch upstream
24
+ # git checkout feature # <--- replace 'feature' with local branch name
25
+ git merge upstream/master
26
+ git push -u origin -f
27
+ ```
28
+ - βœ… Verify all Continuous Integration (CI) **checks are passing**.
29
+ - βœ… 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
30
+
31
+ issue-message: |
32
+ πŸ‘‹ Hello @${{ github.actor }}, thank you for your interest in YOLOv5 πŸš€! Please visit our ⭐️ [Tutorials](https://github.com/ultralytics/yolov5/wiki#tutorials) to get started, where you can find quickstart guides for simple tasks like [Custom Data Training](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data) all the way to advanced concepts like [Hyperparameter Evolution](https://github.com/ultralytics/yolov5/issues/607).
33
+
34
+ If this is a πŸ› Bug Report, please provide screenshots and **minimum viable code to reproduce your issue**, otherwise we can not help you.
35
+
36
+ If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online [W&B logging](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data#visualize) if available.
37
+
38
+ For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.
39
+
40
+ ## Requirements
41
+
42
+ [**Python>=3.7.0**](https://www.python.org/) with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) installed including [**PyTorch>=1.7**](https://pytorch.org/get-started/locally/). To get started:
43
+ ```bash
44
+ git clone https://github.com/ultralytics/yolov5 # clone
45
+ cd yolov5
46
+ pip install -r requirements.txt # install
47
+ ```
48
+
49
+ ## Environments
50
+
51
+ YOLOv5 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):
52
+
53
+ - **Google Colab and Kaggle** notebooks with free GPU: <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/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/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
54
+ - **Google Cloud** Deep Learning VM. See [GCP Quickstart Guide](https://github.com/ultralytics/yolov5/wiki/GCP-Quickstart)
55
+ - **Amazon** Deep Learning AMI. See [AWS Quickstart Guide](https://github.com/ultralytics/yolov5/wiki/AWS-Quickstart)
56
+ - **Docker Image**. See [Docker Quickstart Guide](https://github.com/ultralytics/yolov5/wiki/Docker-Quickstart) <a href="https://hub.docker.com/r/ultralytics/yolov5"><img src="https://img.shields.io/docker/pulls/ultralytics/yolov5?logo=docker" alt="Docker Pulls"></a>
57
+
58
+
59
+ ## Status
60
+
61
+ <a href="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml"><img src="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml/badge.svg" alt="CI CPU testing"></a>
62
+
63
+ If this badge is green, all [YOLOv5 GitHub Actions](https://github.com/ultralytics/yolov5/actions) Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training ([train.py](https://github.com/ultralytics/yolov5/blob/master/train.py)), validation ([val.py](https://github.com/ultralytics/yolov5/blob/master/val.py)), inference ([detect.py](https://github.com/ultralytics/yolov5/blob/master/detect.py)) and export ([export.py](https://github.com/ultralytics/yolov5/blob/master/export.py)) on macOS, Windows, and Ubuntu every 24 hours and on every commit.
yolov5/.github/workflows/rebase.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://github.com/marketplace/actions/automatic-rebase
2
+
3
+ name: Automatic Rebase
4
+ on:
5
+ issue_comment:
6
+ types: [created]
7
+ jobs:
8
+ rebase:
9
+ name: Rebase
10
+ if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout the latest code
14
+ uses: actions/checkout@v3
15
+ with:
16
+ token: ${{ secrets.ACTIONS_TOKEN }}
17
+ fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
18
+ - name: Automatic Rebase
19
+ uses: cirrus-actions/rebase@1.7
20
+ env:
21
+ GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
yolov5/.github/workflows/stale.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-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@v5
13
+ with:
14
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
15
+ stale-issue-message: |
16
+ πŸ‘‹ Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
17
+
18
+ Access additional [YOLOv5](https://ultralytics.com/yolov5) πŸš€ resources:
19
+ - **Wiki** – https://github.com/ultralytics/yolov5/wiki
20
+ - **Tutorials** – https://github.com/ultralytics/yolov5#tutorials
21
+ - **Docs** – https://docs.ultralytics.com
22
+
23
+ Access additional [Ultralytics](https://ultralytics.com) ⚑ resources:
24
+ - **Ultralytics HUB** – https://ultralytics.com/hub
25
+ - **Vision API** – https://ultralytics.com/yolov5
26
+ - **About Us** – https://ultralytics.com/about
27
+ - **Join Our Team** – https://ultralytics.com/work
28
+ - **Contact Us** – https://ultralytics.com/contact
29
+
30
+ 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!
31
+
32
+ Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐!
33
+
34
+ stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions YOLOv5 πŸš€ and Vision AI ⭐.'
35
+ days-before-stale: 30
36
+ days-before-close: 5
37
+ exempt-issue-labels: 'documentation,tutorial,TODO'
38
+ operations-per-run: 300 # The maximum number of operations per run, used to control rate limiting.
yolov5/.gitignore ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Repo-specific GitIgnore ----------------------------------------------------------------------------------------------
2
+ *.jpg
3
+ *.jpeg
4
+ *.png
5
+ *.bmp
6
+ *.tif
7
+ *.tiff
8
+ *.heic
9
+ *.JPG
10
+ *.JPEG
11
+ *.PNG
12
+ *.BMP
13
+ *.TIF
14
+ *.TIFF
15
+ *.HEIC
16
+ *.mp4
17
+ *.mov
18
+ *.MOV
19
+ *.avi
20
+ *.data
21
+ *.json
22
+ *.cfg
23
+ !setup.cfg
24
+ !cfg/yolov3*.cfg
25
+
26
+ storage.googleapis.com
27
+ runs/*
28
+ data/*
29
+ data/images/*
30
+ !data/*.yaml
31
+ !data/hyps
32
+ !data/scripts
33
+ !data/images
34
+ !data/images/zidane.jpg
35
+ !data/images/bus.jpg
36
+ !data/*.sh
37
+
38
+ results*.csv
39
+
40
+ # Datasets -------------------------------------------------------------------------------------------------------------
41
+ coco/
42
+ coco128/
43
+ VOC/
44
+
45
+ # MATLAB GitIgnore -----------------------------------------------------------------------------------------------------
46
+ *.m~
47
+ *.mat
48
+ !targets*.mat
49
+
50
+ # Neural Network weights -----------------------------------------------------------------------------------------------
51
+ *.weights
52
+ *.pt
53
+ *.pb
54
+ *.onnx
55
+ *.engine
56
+ *.mlmodel
57
+ *.torchscript
58
+ *.tflite
59
+ *.h5
60
+ *_saved_model/
61
+ *_web_model/
62
+ *_openvino_model/
63
+ darknet53.conv.74
64
+ yolov3-tiny.conv.15
65
+
66
+ # GitHub Python GitIgnore ----------------------------------------------------------------------------------------------
67
+ # Byte-compiled / optimized / DLL files
68
+ __pycache__/
69
+ *.py[cod]
70
+ *$py.class
71
+
72
+ # C extensions
73
+ *.so
74
+
75
+ # Distribution / packaging
76
+ .Python
77
+ env/
78
+ build/
79
+ develop-eggs/
80
+ dist/
81
+ downloads/
82
+ eggs/
83
+ .eggs/
84
+ lib/
85
+ lib64/
86
+ parts/
87
+ sdist/
88
+ var/
89
+ wheels/
90
+ *.egg-info/
91
+ /wandb/
92
+ .installed.cfg
93
+ *.egg
94
+
95
+
96
+ # PyInstaller
97
+ # Usually these files are written by a python script from a template
98
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
99
+ *.manifest
100
+ *.spec
101
+
102
+ # Installer logs
103
+ pip-log.txt
104
+ pip-delete-this-directory.txt
105
+
106
+ # Unit test / coverage reports
107
+ htmlcov/
108
+ .tox/
109
+ .coverage
110
+ .coverage.*
111
+ .cache
112
+ nosetests.xml
113
+ coverage.xml
114
+ *.cover
115
+ .hypothesis/
116
+
117
+ # Translations
118
+ *.mo
119
+ *.pot
120
+
121
+ # Django stuff:
122
+ *.log
123
+ local_settings.py
124
+
125
+ # Flask stuff:
126
+ instance/
127
+ .webassets-cache
128
+
129
+ # Scrapy stuff:
130
+ .scrapy
131
+
132
+ # Sphinx documentation
133
+ docs/_build/
134
+
135
+ # PyBuilder
136
+ target/
137
+
138
+ # Jupyter Notebook
139
+ .ipynb_checkpoints
140
+
141
+ # pyenv
142
+ .python-version
143
+
144
+ # celery beat schedule file
145
+ celerybeat-schedule
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # dotenv
151
+ .env
152
+
153
+ # virtualenv
154
+ .venv*
155
+ venv*/
156
+ ENV*/
157
+
158
+ # Spyder project settings
159
+ .spyderproject
160
+ .spyproject
161
+
162
+ # Rope project settings
163
+ .ropeproject
164
+
165
+ # mkdocs documentation
166
+ /site
167
+
168
+ # mypy
169
+ .mypy_cache/
170
+
171
+
172
+ # https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -----------------------------------------------
173
+
174
+ # General
175
+ .DS_Store
176
+ .AppleDouble
177
+ .LSOverride
178
+
179
+ # Icon must end with two \r
180
+ Icon
181
+ Icon?
182
+
183
+ # Thumbnails
184
+ ._*
185
+
186
+ # Files that might appear in the root of a volume
187
+ .DocumentRevisions-V100
188
+ .fseventsd
189
+ .Spotlight-V100
190
+ .TemporaryItems
191
+ .Trashes
192
+ .VolumeIcon.icns
193
+ .com.apple.timemachine.donotpresent
194
+
195
+ # Directories potentially created on remote AFP share
196
+ .AppleDB
197
+ .AppleDesktop
198
+ Network Trash Folder
199
+ Temporary Items
200
+ .apdisk
201
+
202
+
203
+ # https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
204
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
205
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
206
+
207
+ # User-specific stuff:
208
+ .idea/*
209
+ .idea/**/workspace.xml
210
+ .idea/**/tasks.xml
211
+ .idea/dictionaries
212
+ .html # Bokeh Plots
213
+ .pg # TensorFlow Frozen Graphs
214
+ .avi # videos
215
+
216
+ # Sensitive or high-churn files:
217
+ .idea/**/dataSources/
218
+ .idea/**/dataSources.ids
219
+ .idea/**/dataSources.local.xml
220
+ .idea/**/sqlDataSources.xml
221
+ .idea/**/dynamic.xml
222
+ .idea/**/uiDesigner.xml
223
+
224
+ # Gradle:
225
+ .idea/**/gradle.xml
226
+ .idea/**/libraries
227
+
228
+ # CMake
229
+ cmake-build-debug/
230
+ cmake-build-release/
231
+
232
+ # Mongo Explorer plugin:
233
+ .idea/**/mongoSettings.xml
234
+
235
+ ## File-based project format:
236
+ *.iws
237
+
238
+ ## Plugin-specific files:
239
+
240
+ # IntelliJ
241
+ out/
242
+
243
+ # mpeltonen/sbt-idea plugin
244
+ .idea_modules/
245
+
246
+ # JIRA plugin
247
+ atlassian-ide-plugin.xml
248
+
249
+ # Cursive Clojure plugin
250
+ .idea/replstate.xml
251
+
252
+ # Crashlytics plugin (for Android Studio and IntelliJ)
253
+ com_crashlytics_export_strings.xml
254
+ crashlytics.properties
255
+ crashlytics-build.properties
256
+ fabric.properties
yolov5/.pre-commit-config.yaml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Define hooks for code formations
2
+ # Will be applied on any updated commit files if a user has installed and linked commit hook
3
+
4
+ default_language_version:
5
+ python: python3.8
6
+
7
+ # Define bot property if installed via https://github.com/marketplace/pre-commit-ci
8
+ ci:
9
+ autofix_prs: true
10
+ autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
11
+ autoupdate_schedule: monthly
12
+ # submodules: true
13
+
14
+ repos:
15
+ - repo: https://github.com/pre-commit/pre-commit-hooks
16
+ rev: v4.2.0
17
+ hooks:
18
+ - id: end-of-file-fixer
19
+ - id: trailing-whitespace
20
+ - id: check-case-conflict
21
+ - id: check-yaml
22
+ - id: check-toml
23
+ - id: pretty-format-json
24
+ - id: check-docstring-first
25
+
26
+ - repo: https://github.com/asottile/pyupgrade
27
+ rev: v2.32.1
28
+ hooks:
29
+ - id: pyupgrade
30
+ name: Upgrade code
31
+ args: [ --py37-plus ]
32
+
33
+ - repo: https://github.com/PyCQA/isort
34
+ rev: 5.10.1
35
+ hooks:
36
+ - id: isort
37
+ name: Sort imports
38
+
39
+ - repo: https://github.com/pre-commit/mirrors-yapf
40
+ rev: v0.32.0
41
+ hooks:
42
+ - id: yapf
43
+ name: YAPF formatting
44
+
45
+ - repo: https://github.com/executablebooks/mdformat
46
+ rev: 0.7.14
47
+ hooks:
48
+ - id: mdformat
49
+ name: MD formatting
50
+ additional_dependencies:
51
+ - mdformat-gfm
52
+ - mdformat-black
53
+ exclude: |
54
+ (?x)^(
55
+ README.md
56
+ )$
57
+
58
+ - repo: https://github.com/asottile/yesqa
59
+ rev: v1.3.0
60
+ hooks:
61
+ - id: yesqa
62
+
63
+ - repo: https://github.com/PyCQA/flake8
64
+ rev: 4.0.1
65
+ hooks:
66
+ - id: flake8
67
+ name: PEP8
yolov5/7.1.2 ADDED
@@ -0,0 +1 @@
 
 
1
+ Requirement already satisfied: Pillow in c:\users\aircar\appdata\local\programs\python\python37-32\lib\site-packages (8.1.2)
yolov5/CONTRIBUTING.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Contributing to YOLOv5 πŸš€
2
+
3
+ We love your input! We want to make contributing to YOLOv5 as easy and transparent as possible, whether it's:
4
+
5
+ - Reporting a bug
6
+ - Discussing the current state of the code
7
+ - Submitting a fix
8
+ - Proposing a new feature
9
+ - Becoming a maintainer
10
+
11
+ YOLOv5 works so well due to our combined community effort, and for every small improvement you contribute you will be
12
+ helping push the frontiers of what's possible in AI πŸ˜ƒ!
13
+
14
+ ## Submitting a Pull Request (PR) πŸ› οΈ
15
+
16
+ Submitting a PR is easy! This example shows how to submit a PR for updating `requirements.txt` in 4 steps:
17
+
18
+ ### 1. Select File to Update
19
+
20
+ Select `requirements.txt` to update by clicking on it in GitHub.
21
+
22
+ <p align="center"><img width="800" alt="PR_step1" src="https://user-images.githubusercontent.com/26833433/122260847-08be2600-ced4-11eb-828b-8287ace4136c.png"></p>
23
+
24
+ ### 2. Click 'Edit this file'
25
+
26
+ Button is in top-right corner.
27
+
28
+ <p align="center"><img width="800" alt="PR_step2" src="https://user-images.githubusercontent.com/26833433/122260844-06f46280-ced4-11eb-9eec-b8a24be519ca.png"></p>
29
+
30
+ ### 3. Make Changes
31
+
32
+ Change `matplotlib` version from `3.2.2` to `3.3`.
33
+
34
+ <p align="center"><img width="800" alt="PR_step3" src="https://user-images.githubusercontent.com/26833433/122260853-0a87e980-ced4-11eb-9fd2-3650fb6e0842.png"></p>
35
+
36
+ ### 4. Preview Changes and Submit PR
37
+
38
+ Click on the **Preview changes** tab to verify your updates. At the bottom of the screen select 'Create a **new branch**
39
+ for this commit', assign your branch a descriptive name such as `fix/matplotlib_version` and click the green **Propose
40
+ changes** button. All done, your PR is now submitted to YOLOv5 for review and approval πŸ˜ƒ!
41
+
42
+ <p align="center"><img width="800" alt="PR_step4" src="https://user-images.githubusercontent.com/26833433/122260856-0b208000-ced4-11eb-8e8e-77b6151cbcc3.png"></p>
43
+
44
+ ### PR recommendations
45
+
46
+ To allow your work to be integrated as seamlessly as possible, we advise you to:
47
+
48
+ - βœ… Verify your PR is **up-to-date with upstream/master.** If your PR is behind upstream/master an
49
+ automatic [GitHub Actions](https://github.com/ultralytics/yolov5/blob/master/.github/workflows/rebase.yml) merge may
50
+ be attempted by writing /rebase in a new comment, or by running the following code, replacing 'feature' with the name
51
+ of your local branch:
52
+
53
+ ```bash
54
+ git remote add upstream https://github.com/ultralytics/yolov5.git
55
+ git fetch upstream
56
+ # git checkout feature # <--- replace 'feature' with local branch name
57
+ git merge upstream/master
58
+ git push -u origin -f
59
+ ```
60
+
61
+ - βœ… Verify all Continuous Integration (CI) **checks are passing**.
62
+ - βœ… Reduce changes to the absolute **minimum** required for your bug fix or feature addition. _"It is not daily increase
63
+ but daily decrease, hack away the unessential. The closer to the source, the less wastage there is."_ β€” Bruce Lee
64
+
65
+ ## Submitting a Bug Report πŸ›
66
+
67
+ If you spot a problem with YOLOv5 please submit a Bug Report!
68
+
69
+ For us to start investigating a possible problem we need to be able to reproduce it ourselves first. We've created a few
70
+ short guidelines below to help users provide what we need in order to get started.
71
+
72
+ When asking a question, people will be better able to provide help if you provide **code** that they can easily
73
+ understand and use to **reproduce** the problem. This is referred to by community members as creating
74
+ a [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). Your code that reproduces
75
+ the problem should be:
76
+
77
+ - βœ… **Minimal** – Use as little code as possible that still produces the same problem
78
+ - βœ… **Complete** – Provide **all** parts someone else needs to reproduce your problem in the question itself
79
+ - βœ… **Reproducible** – Test the code you're about to provide to make sure it reproduces the problem
80
+
81
+ In addition to the above requirements, for [Ultralytics](https://ultralytics.com/) to provide assistance your code
82
+ should be:
83
+
84
+ - βœ… **Current** – Verify that your code is up-to-date with current
85
+ GitHub [master](https://github.com/ultralytics/yolov5/tree/master), and if necessary `git pull` or `git clone` a new
86
+ copy to ensure your problem has not already been resolved by previous commits.
87
+ - βœ… **Unmodified** – Your problem must be reproducible without any modifications to the codebase in this
88
+ repository. [Ultralytics](https://ultralytics.com/) does not provide support for custom code ⚠️.
89
+
90
+ If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the πŸ›
91
+ **Bug Report** [template](https://github.com/ultralytics/yolov5/issues/new/choose) and providing
92
+ a [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) to help us better
93
+ understand and diagnose your problem.
94
+
95
+ ## License
96
+
97
+ By contributing, you agree that your contributions will be licensed under
98
+ the [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/)
yolov5/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://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 General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
yolov5/README.md ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <p>
3
+ <a align="left" href="https://ultralytics.com/yolov5" target="_blank">
4
+ <img width="850" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/splash.jpg"></a>
5
+ </p>
6
+ <br>
7
+ <div>
8
+ <a href="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml"><img src="https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml/badge.svg" alt="CI CPU testing"></a>
9
+ <a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="YOLOv5 Citation"></a>
10
+ <a href="https://hub.docker.com/r/ultralytics/yolov5"><img src="https://img.shields.io/docker/pulls/ultralytics/yolov5?logo=docker" alt="Docker Pulls"></a>
11
+ <br>
12
+ <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
13
+ <a href="https://www.kaggle.com/ultralytics/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
14
+ <a href="https://join.slack.com/t/ultralytics/shared_invite/zt-w29ei8bp-jczz7QYUmDtgo6r6KcMIAg"><img src="https://img.shields.io/badge/Slack-Join_Forum-blue.svg?logo=slack" alt="Join Forum"></a>
15
+ </div>
16
+
17
+ <br>
18
+ <p>
19
+ YOLOv5 πŸš€ is a family of object detection architectures and models pretrained on the COCO dataset, and represents <a href="https://ultralytics.com">Ultralytics</a>
20
+ open-source research into future vision AI methods, incorporating lessons learned and best practices evolved over thousands of hours of research and development.
21
+ </p>
22
+
23
+ <div align="center">
24
+ <a href="https://github.com/ultralytics">
25
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-github.png" width="2%"/>
26
+ </a>
27
+ <img width="2%" />
28
+ <a href="https://www.linkedin.com/company/ultralytics">
29
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-linkedin.png" width="2%"/>
30
+ </a>
31
+ <img width="2%" />
32
+ <a href="https://twitter.com/ultralytics">
33
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-twitter.png" width="2%"/>
34
+ </a>
35
+ <img width="2%" />
36
+ <a href="https://www.producthunt.com/@glenn_jocher">
37
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-producthunt.png" width="2%"/>
38
+ </a>
39
+ <img width="2%" />
40
+ <a href="https://youtube.com/ultralytics">
41
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-youtube.png" width="2%"/>
42
+ </a>
43
+ <img width="2%" />
44
+ <a href="https://www.facebook.com/ultralytics">
45
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-facebook.png" width="2%"/>
46
+ </a>
47
+ <img width="2%" />
48
+ <a href="https://www.instagram.com/ultralytics/">
49
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-instagram.png" width="2%"/>
50
+ </a>
51
+ </div>
52
+
53
+ <!--
54
+ <a align="center" href="https://ultralytics.com/yolov5" target="_blank">
55
+ <img width="800" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/banner-api.png"></a>
56
+ -->
57
+
58
+ </div>
59
+
60
+ ## <div align="center">Documentation</div>
61
+
62
+ See the [YOLOv5 Docs](https://docs.ultralytics.com) for full documentation on training, testing and deployment.
63
+
64
+ ## <div align="center">Quick Start Examples</div>
65
+
66
+ <details open>
67
+ <summary>Install</summary>
68
+
69
+ Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a
70
+ [**Python>=3.7.0**](https://www.python.org/) environment, including
71
+ [**PyTorch>=1.7**](https://pytorch.org/get-started/locally/).
72
+
73
+ ```bash
74
+ git clone https://github.com/ultralytics/yolov5 # clone
75
+ cd yolov5
76
+ pip install -r requirements.txt # install
77
+ ```
78
+
79
+ </details>
80
+
81
+ <details open>
82
+ <summary>Inference</summary>
83
+
84
+ YOLOv5 [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36) inference. [Models](https://github.com/ultralytics/yolov5/tree/master/models) download automatically from the latest
85
+ YOLOv5 [release](https://github.com/ultralytics/yolov5/releases).
86
+
87
+ ```python
88
+ import torch
89
+
90
+ # Model
91
+ model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - yolov5x6, custom
92
+
93
+ # Images
94
+ img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list
95
+
96
+ # Inference
97
+ results = model(img)
98
+
99
+ # Results
100
+ results.print() # or .show(), .save(), .crop(), .pandas(), etc.
101
+ ```
102
+
103
+ </details>
104
+
105
+ <details>
106
+ <summary>Inference with detect.py</summary>
107
+
108
+ `detect.py` runs inference on a variety of sources, downloading [models](https://github.com/ultralytics/yolov5/tree/master/models) automatically from
109
+ the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases) and saving results to `runs/detect`.
110
+
111
+ ```bash
112
+ python detect.py --source 0 # webcam
113
+ img.jpg # image
114
+ vid.mp4 # video
115
+ path/ # directory
116
+ path/*.jpg # glob
117
+ 'https://youtu.be/Zgi9g1ksQHc' # YouTube
118
+ 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
119
+ ```
120
+
121
+ </details>
122
+
123
+ <details>
124
+ <summary>Training</summary>
125
+
126
+ The commands below reproduce YOLOv5 [COCO](https://github.com/ultralytics/yolov5/blob/master/data/scripts/get_coco.sh)
127
+ results. [Models](https://github.com/ultralytics/yolov5/tree/master/models)
128
+ and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest
129
+ YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). Training times for YOLOv5n/s/m/l/x are
130
+ 1/2/4/6/8 days on a V100 GPU ([Multi-GPU](https://github.com/ultralytics/yolov5/issues/475) times faster). Use the
131
+ largest `--batch-size` possible, or pass `--batch-size -1` for
132
+ YOLOv5 [AutoBatch](https://github.com/ultralytics/yolov5/pull/5092). Batch sizes shown for V100-16GB.
133
+
134
+ ```bash
135
+ python train.py --data coco.yaml --cfg yolov5n.yaml --weights '' --batch-size 128
136
+ yolov5s 64
137
+ yolov5m 40
138
+ yolov5l 24
139
+ yolov5x 16
140
+ ```
141
+
142
+ <img width="800" src="https://user-images.githubusercontent.com/26833433/90222759-949d8800-ddc1-11ea-9fa1-1c97eed2b963.png">
143
+
144
+ </details>
145
+
146
+ <details open>
147
+ <summary>Tutorials</summary>
148
+
149
+ - [Train Custom Data](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data)Β  πŸš€ RECOMMENDED
150
+ - [Tips for Best Training Results](https://github.com/ultralytics/yolov5/wiki/Tips-for-Best-Training-Results)  ☘️
151
+ RECOMMENDED
152
+ - [Weights & Biases Logging](https://github.com/ultralytics/yolov5/issues/1289)  🌟 NEW
153
+ - [Roboflow for Datasets, Labeling, and Active Learning](https://github.com/ultralytics/yolov5/issues/4975)  🌟 NEW
154
+ - [Multi-GPU Training](https://github.com/ultralytics/yolov5/issues/475)
155
+ - [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36)  ⭐ NEW
156
+ - [TFLite, ONNX, CoreML, TensorRT Export](https://github.com/ultralytics/yolov5/issues/251) πŸš€
157
+ - [Test-Time Augmentation (TTA)](https://github.com/ultralytics/yolov5/issues/303)
158
+ - [Model Ensembling](https://github.com/ultralytics/yolov5/issues/318)
159
+ - [Model Pruning/Sparsity](https://github.com/ultralytics/yolov5/issues/304)
160
+ - [Hyperparameter Evolution](https://github.com/ultralytics/yolov5/issues/607)
161
+ - [Transfer Learning with Frozen Layers](https://github.com/ultralytics/yolov5/issues/1314)  ⭐ NEW
162
+ - [Architecture Summary](https://github.com/ultralytics/yolov5/issues/6998)  ⭐ NEW
163
+
164
+ </details>
165
+
166
+ ## <div align="center">Environments</div>
167
+
168
+ Get started in seconds with our verified environments. Click each icon below for details.
169
+
170
+ <div align="center">
171
+ <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb">
172
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-colab-small.png" width="15%"/>
173
+ </a>
174
+ <a href="https://www.kaggle.com/ultralytics/yolov5">
175
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-kaggle-small.png" width="15%"/>
176
+ </a>
177
+ <a href="https://hub.docker.com/r/ultralytics/yolov5">
178
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-docker-small.png" width="15%"/>
179
+ </a>
180
+ <a href="https://github.com/ultralytics/yolov5/wiki/AWS-Quickstart">
181
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-aws-small.png" width="15%"/>
182
+ </a>
183
+ <a href="https://github.com/ultralytics/yolov5/wiki/GCP-Quickstart">
184
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-gcp-small.png" width="15%"/>
185
+ </a>
186
+ </div>
187
+
188
+ ## <div align="center">Integrations</div>
189
+
190
+ <div align="center">
191
+ <a href="https://wandb.ai/site?utm_campaign=repo_yolo_readme">
192
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-wb-long.png" width="49%"/>
193
+ </a>
194
+ <a href="https://roboflow.com/?ref=ultralytics">
195
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-roboflow-long.png" width="49%"/>
196
+ </a>
197
+ </div>
198
+
199
+ |Weights and Biases|Roboflow ⭐ NEW|
200
+ |:-:|:-:|
201
+ |Automatically track and visualize all your YOLOv5 training runs in the cloud with [Weights & Biases](https://wandb.ai/site?utm_campaign=repo_yolo_readme)|Label and export your custom datasets directly to YOLOv5 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) |
202
+
203
+ <!-- ## <div align="center">Compete and Win</div>
204
+
205
+ We are super excited about our first-ever Ultralytics YOLOv5 πŸš€ EXPORT Competition with **$10,000** in cash prizes!
206
+
207
+ <p align="center">
208
+ <a href="https://github.com/ultralytics/yolov5/discussions/3213">
209
+ <img width="850" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/banner-export-competition.png"></a>
210
+ </p> -->
211
+
212
+ ## <div align="center">Why YOLOv5</div>
213
+
214
+ <p align="left"><img width="800" src="https://user-images.githubusercontent.com/26833433/155040763-93c22a27-347c-4e3c-847a-8094621d3f4e.png"></p>
215
+ <details>
216
+ <summary>YOLOv5-P5 640 Figure (click to expand)</summary>
217
+
218
+ <p align="left"><img width="800" src="https://user-images.githubusercontent.com/26833433/155040757-ce0934a3-06a6-43dc-a979-2edbbd69ea0e.png"></p>
219
+ </details>
220
+ <details>
221
+ <summary>Figure Notes (click to expand)</summary>
222
+
223
+ - **COCO AP val** denotes mAP@0.5:0.95 metric measured on the 5000-image [COCO val2017](http://cocodataset.org) dataset over various inference sizes from 256 to 1536.
224
+ - **GPU Speed** measures average inference time per image on [COCO val2017](http://cocodataset.org) dataset using a [AWS p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) V100 instance at batch-size 32.
225
+ - **EfficientDet** data from [google/automl](https://github.com/google/automl) at batch size 8.
226
+ - **Reproduce** by `python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n6.pt yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt`
227
+
228
+ </details>
229
+
230
+ ### Pretrained Checkpoints
231
+
232
+ |Model |size<br><sup>(pixels) |mAP<sup>val<br>0.5:0.95 |mAP<sup>val<br>0.5 |Speed<br><sup>CPU b1<br>(ms) |Speed<br><sup>V100 b1<br>(ms) |Speed<br><sup>V100 b32<br>(ms) |params<br><sup>(M) |FLOPs<br><sup>@640 (B)
233
+ |--- |--- |--- |--- |--- |--- |--- |--- |---
234
+ |[YOLOv5n][assets] |640 |28.0 |45.7 |**45** |**6.3**|**0.6**|**1.9**|**4.5**
235
+ |[YOLOv5s][assets] |640 |37.4 |56.8 |98 |6.4 |0.9 |7.2 |16.5
236
+ |[YOLOv5m][assets] |640 |45.4 |64.1 |224 |8.2 |1.7 |21.2 |49.0
237
+ |[YOLOv5l][assets] |640 |49.0 |67.3 |430 |10.1 |2.7 |46.5 |109.1
238
+ |[YOLOv5x][assets] |640 |50.7 |68.9 |766 |12.1 |4.8 |86.7 |205.7
239
+ | | | | | | | | |
240
+ |[YOLOv5n6][assets] |1280 |36.0 |54.4 |153 |8.1 |2.1 |3.2 |4.6
241
+ |[YOLOv5s6][assets] |1280 |44.8 |63.7 |385 |8.2 |3.6 |12.6 |16.8
242
+ |[YOLOv5m6][assets] |1280 |51.3 |69.3 |887 |11.1 |6.8 |35.7 |50.0
243
+ |[YOLOv5l6][assets] |1280 |53.7 |71.3 |1784 |15.8 |10.5 |76.8 |111.4
244
+ |[YOLOv5x6][assets]<br>+ [TTA][TTA]|1280<br>1536 |55.0<br>**55.8** |72.7<br>**72.7** |3136<br>- |26.2<br>- |19.4<br>- |140.7<br>- |209.8<br>-
245
+
246
+ <details>
247
+ <summary>Table Notes (click to expand)</summary>
248
+
249
+ - All checkpoints are trained to 300 epochs with default settings. Nano and Small models use [hyp.scratch-low.yaml](https://github.com/ultralytics/yolov5/blob/master/data/hyps/hyp.scratch-low.yaml) hyps, all others use [hyp.scratch-high.yaml](https://github.com/ultralytics/yolov5/blob/master/data/hyps/hyp.scratch-high.yaml).
250
+ - **mAP<sup>val</sup>** values are for single-model single-scale on [COCO val2017](http://cocodataset.org) dataset.<br>Reproduce by `python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65`
251
+ - **Speed** averaged over COCO val images using a [AWS p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) instance. NMS times (~1 ms/img) not included.<br>Reproduce by `python val.py --data coco.yaml --img 640 --task speed --batch 1`
252
+ - **TTA** [Test Time Augmentation](https://github.com/ultralytics/yolov5/issues/303) includes reflection and scale augmentations.<br>Reproduce by `python val.py --data coco.yaml --img 1536 --iou 0.7 --augment`
253
+
254
+ </details>
255
+
256
+ ## <div align="center">Contribute</div>
257
+
258
+ We love your input! We want to make contributing to YOLOv5 as easy and transparent as possible. Please see our [Contributing Guide](CONTRIBUTING.md) to get started, and fill out the [YOLOv5 Survey](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experiences. Thank you to all our contributors!
259
+
260
+ <a href="https://github.com/ultralytics/yolov5/graphs/contributors"><img src="https://opencollective.com/ultralytics/contributors.svg?width=990" /></a>
261
+
262
+ ## <div align="center">Contact</div>
263
+
264
+ For YOLOv5 bugs and feature requests please visit [GitHub Issues](https://github.com/ultralytics/yolov5/issues). For business inquiries or
265
+ professional support requests please visit [https://ultralytics.com/contact](https://ultralytics.com/contact).
266
+
267
+ <br>
268
+
269
+ <div align="center">
270
+ <a href="https://github.com/ultralytics">
271
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-github.png" width="3%"/>
272
+ </a>
273
+ <img width="3%" />
274
+ <a href="https://www.linkedin.com/company/ultralytics">
275
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-linkedin.png" width="3%"/>
276
+ </a>
277
+ <img width="3%" />
278
+ <a href="https://twitter.com/ultralytics">
279
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-twitter.png" width="3%"/>
280
+ </a>
281
+ <img width="3%" />
282
+ <a href="https://www.producthunt.com/@glenn_jocher">
283
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-producthunt.png" width="3%"/>
284
+ </a>
285
+ <img width="3%" />
286
+ <a href="https://youtube.com/ultralytics">
287
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-youtube.png" width="3%"/>
288
+ </a>
289
+ <img width="3%" />
290
+ <a href="https://www.facebook.com/ultralytics">
291
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-facebook.png" width="3%"/>
292
+ </a>
293
+ <img width="3%" />
294
+ <a href="https://www.instagram.com/ultralytics/">
295
+ <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-instagram.png" width="3%"/>
296
+ </a>
297
+ </div>
298
+
299
+ [assets]: https://github.com/ultralytics/yolov5/releases
300
+ [tta]: https://github.com/ultralytics/yolov5/issues/303
yolov5/data/Argoverse.yaml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Argoverse-HD dataset (ring-front-center camera) http://www.cs.cmu.edu/~mengtial/proj/streaming/ by Argo AI
3
+ # Example usage: python train.py --data Argoverse.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── Argoverse ← downloads here (31.3 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/Argoverse # dataset root dir
12
+ train: Argoverse-1.1/images/train/ # train images (relative to 'path') 39384 images
13
+ val: Argoverse-1.1/images/val/ # val images (relative to 'path') 15062 images
14
+ test: Argoverse-1.1/images/test/ # test images (optional) https://eval.ai/web/challenges/challenge-page/800/overview
15
+
16
+ # Classes
17
+ nc: 8 # number of classes
18
+ names: ['person', 'bicycle', 'car', 'motorcycle', 'bus', 'truck', 'traffic_light', 'stop_sign'] # class names
19
+
20
+
21
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
22
+ download: |
23
+ import json
24
+
25
+ from tqdm import tqdm
26
+ from utils.general import download, Path
27
+
28
+
29
+ def argoverse2yolo(set):
30
+ labels = {}
31
+ a = json.load(open(set, "rb"))
32
+ for annot in tqdm(a['annotations'], desc=f"Converting {set} to YOLOv5 format..."):
33
+ img_id = annot['image_id']
34
+ img_name = a['images'][img_id]['name']
35
+ img_label_name = f'{img_name[:-3]}txt'
36
+
37
+ cls = annot['category_id'] # instance class id
38
+ x_center, y_center, width, height = annot['bbox']
39
+ x_center = (x_center + width / 2) / 1920.0 # offset and scale
40
+ y_center = (y_center + height / 2) / 1200.0 # offset and scale
41
+ width /= 1920.0 # scale
42
+ height /= 1200.0 # scale
43
+
44
+ img_dir = set.parents[2] / 'Argoverse-1.1' / 'labels' / a['seq_dirs'][a['images'][annot['image_id']]['sid']]
45
+ if not img_dir.exists():
46
+ img_dir.mkdir(parents=True, exist_ok=True)
47
+
48
+ k = str(img_dir / img_label_name)
49
+ if k not in labels:
50
+ labels[k] = []
51
+ labels[k].append(f"{cls} {x_center} {y_center} {width} {height}\n")
52
+
53
+ for k in labels:
54
+ with open(k, "w") as f:
55
+ f.writelines(labels[k])
56
+
57
+
58
+ # Download
59
+ dir = Path('../datasets/Argoverse') # dataset root dir
60
+ urls = ['https://argoverse-hd.s3.us-east-2.amazonaws.com/Argoverse-HD-Full.zip']
61
+ download(urls, dir=dir, delete=False)
62
+
63
+ # Convert
64
+ annotations_dir = 'Argoverse-HD/annotations/'
65
+ (dir / 'Argoverse-1.1' / 'tracking').rename(dir / 'Argoverse-1.1' / 'images') # rename 'tracking' to 'images'
66
+ for d in "train.json", "val.json":
67
+ argoverse2yolo(dir / annotations_dir / d) # convert VisDrone annotations to YOLO labels
yolov5/data/GlobalWheat2020.yaml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Global Wheat 2020 dataset http://www.global-wheat.com/ by University of Saskatchewan
3
+ # Example usage: python train.py --data GlobalWheat2020.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── GlobalWheat2020 ← downloads here (7.0 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/GlobalWheat2020 # dataset root dir
12
+ train: # train images (relative to 'path') 3422 images
13
+ - images/arvalis_1
14
+ - images/arvalis_2
15
+ - images/arvalis_3
16
+ - images/ethz_1
17
+ - images/rres_1
18
+ - images/inrae_1
19
+ - images/usask_1
20
+ val: # val images (relative to 'path') 748 images (WARNING: train set contains ethz_1)
21
+ - images/ethz_1
22
+ test: # test images (optional) 1276 images
23
+ - images/utokyo_1
24
+ - images/utokyo_2
25
+ - images/nau_1
26
+ - images/uq_1
27
+
28
+ # Classes
29
+ nc: 1 # number of classes
30
+ names: ['wheat_head'] # class names
31
+
32
+
33
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
34
+ download: |
35
+ from utils.general import download, Path
36
+
37
+
38
+ # Download
39
+ dir = Path(yaml['path']) # dataset root dir
40
+ urls = ['https://zenodo.org/record/4298502/files/global-wheat-codalab-official.zip',
41
+ 'https://github.com/ultralytics/yolov5/releases/download/v1.0/GlobalWheat2020_labels.zip']
42
+ download(urls, dir=dir)
43
+
44
+ # Make Directories
45
+ for p in 'annotations', 'images', 'labels':
46
+ (dir / p).mkdir(parents=True, exist_ok=True)
47
+
48
+ # Move
49
+ for p in 'arvalis_1', 'arvalis_2', 'arvalis_3', 'ethz_1', 'rres_1', 'inrae_1', 'usask_1', \
50
+ 'utokyo_1', 'utokyo_2', 'nau_1', 'uq_1':
51
+ (dir / p).rename(dir / 'images' / p) # move to /images
52
+ f = (dir / p).with_suffix('.json') # json file
53
+ if f.exists():
54
+ f.rename((dir / 'annotations' / p).with_suffix('.json')) # move to /annotations
yolov5/data/Objects365.yaml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Objects365 dataset https://www.objects365.org/ by Megvii
3
+ # Example usage: python train.py --data Objects365.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── Objects365 ← downloads here (712 GB = 367G data + 345G zips)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/Objects365 # dataset root dir
12
+ train: images/train # train images (relative to 'path') 1742289 images
13
+ val: images/val # val images (relative to 'path') 80000 images
14
+ test: # test images (optional)
15
+
16
+ # Classes
17
+ nc: 365 # number of classes
18
+ names: ['Person', 'Sneakers', 'Chair', 'Other Shoes', 'Hat', 'Car', 'Lamp', 'Glasses', 'Bottle', 'Desk', 'Cup',
19
+ 'Street Lights', 'Cabinet/shelf', 'Handbag/Satchel', 'Bracelet', 'Plate', 'Picture/Frame', 'Helmet', 'Book',
20
+ 'Gloves', 'Storage box', 'Boat', 'Leather Shoes', 'Flower', 'Bench', 'Potted Plant', 'Bowl/Basin', 'Flag',
21
+ 'Pillow', 'Boots', 'Vase', 'Microphone', 'Necklace', 'Ring', 'SUV', 'Wine Glass', 'Belt', 'Monitor/TV',
22
+ 'Backpack', 'Umbrella', 'Traffic Light', 'Speaker', 'Watch', 'Tie', 'Trash bin Can', 'Slippers', 'Bicycle',
23
+ 'Stool', 'Barrel/bucket', 'Van', 'Couch', 'Sandals', 'Basket', 'Drum', 'Pen/Pencil', 'Bus', 'Wild Bird',
24
+ 'High Heels', 'Motorcycle', 'Guitar', 'Carpet', 'Cell Phone', 'Bread', 'Camera', 'Canned', 'Truck',
25
+ 'Traffic cone', 'Cymbal', 'Lifesaver', 'Towel', 'Stuffed Toy', 'Candle', 'Sailboat', 'Laptop', 'Awning',
26
+ 'Bed', 'Faucet', 'Tent', 'Horse', 'Mirror', 'Power outlet', 'Sink', 'Apple', 'Air Conditioner', 'Knife',
27
+ 'Hockey Stick', 'Paddle', 'Pickup Truck', 'Fork', 'Traffic Sign', 'Balloon', 'Tripod', 'Dog', 'Spoon', 'Clock',
28
+ 'Pot', 'Cow', 'Cake', 'Dinning Table', 'Sheep', 'Hanger', 'Blackboard/Whiteboard', 'Napkin', 'Other Fish',
29
+ 'Orange/Tangerine', 'Toiletry', 'Keyboard', 'Tomato', 'Lantern', 'Machinery Vehicle', 'Fan',
30
+ 'Green Vegetables', 'Banana', 'Baseball Glove', 'Airplane', 'Mouse', 'Train', 'Pumpkin', 'Soccer', 'Skiboard',
31
+ 'Luggage', 'Nightstand', 'Tea pot', 'Telephone', 'Trolley', 'Head Phone', 'Sports Car', 'Stop Sign',
32
+ 'Dessert', 'Scooter', 'Stroller', 'Crane', 'Remote', 'Refrigerator', 'Oven', 'Lemon', 'Duck', 'Baseball Bat',
33
+ 'Surveillance Camera', 'Cat', 'Jug', 'Broccoli', 'Piano', 'Pizza', 'Elephant', 'Skateboard', 'Surfboard',
34
+ 'Gun', 'Skating and Skiing shoes', 'Gas stove', 'Donut', 'Bow Tie', 'Carrot', 'Toilet', 'Kite', 'Strawberry',
35
+ 'Other Balls', 'Shovel', 'Pepper', 'Computer Box', 'Toilet Paper', 'Cleaning Products', 'Chopsticks',
36
+ 'Microwave', 'Pigeon', 'Baseball', 'Cutting/chopping Board', 'Coffee Table', 'Side Table', 'Scissors',
37
+ 'Marker', 'Pie', 'Ladder', 'Snowboard', 'Cookies', 'Radiator', 'Fire Hydrant', 'Basketball', 'Zebra', 'Grape',
38
+ 'Giraffe', 'Potato', 'Sausage', 'Tricycle', 'Violin', 'Egg', 'Fire Extinguisher', 'Candy', 'Fire Truck',
39
+ 'Billiards', 'Converter', 'Bathtub', 'Wheelchair', 'Golf Club', 'Briefcase', 'Cucumber', 'Cigar/Cigarette',
40
+ 'Paint Brush', 'Pear', 'Heavy Truck', 'Hamburger', 'Extractor', 'Extension Cord', 'Tong', 'Tennis Racket',
41
+ 'Folder', 'American Football', 'earphone', 'Mask', 'Kettle', 'Tennis', 'Ship', 'Swing', 'Coffee Machine',
42
+ 'Slide', 'Carriage', 'Onion', 'Green beans', 'Projector', 'Frisbee', 'Washing Machine/Drying Machine',
43
+ 'Chicken', 'Printer', 'Watermelon', 'Saxophone', 'Tissue', 'Toothbrush', 'Ice cream', 'Hot-air balloon',
44
+ 'Cello', 'French Fries', 'Scale', 'Trophy', 'Cabbage', 'Hot dog', 'Blender', 'Peach', 'Rice', 'Wallet/Purse',
45
+ 'Volleyball', 'Deer', 'Goose', 'Tape', 'Tablet', 'Cosmetics', 'Trumpet', 'Pineapple', 'Golf Ball',
46
+ 'Ambulance', 'Parking meter', 'Mango', 'Key', 'Hurdle', 'Fishing Rod', 'Medal', 'Flute', 'Brush', 'Penguin',
47
+ 'Megaphone', 'Corn', 'Lettuce', 'Garlic', 'Swan', 'Helicopter', 'Green Onion', 'Sandwich', 'Nuts',
48
+ 'Speed Limit Sign', 'Induction Cooker', 'Broom', 'Trombone', 'Plum', 'Rickshaw', 'Goldfish', 'Kiwi fruit',
49
+ 'Router/modem', 'Poker Card', 'Toaster', 'Shrimp', 'Sushi', 'Cheese', 'Notepaper', 'Cherry', 'Pliers', 'CD',
50
+ 'Pasta', 'Hammer', 'Cue', 'Avocado', 'Hamimelon', 'Flask', 'Mushroom', 'Screwdriver', 'Soap', 'Recorder',
51
+ 'Bear', 'Eggplant', 'Board Eraser', 'Coconut', 'Tape Measure/Ruler', 'Pig', 'Showerhead', 'Globe', 'Chips',
52
+ 'Steak', 'Crosswalk Sign', 'Stapler', 'Camel', 'Formula 1', 'Pomegranate', 'Dishwasher', 'Crab',
53
+ 'Hoverboard', 'Meat ball', 'Rice Cooker', 'Tuba', 'Calculator', 'Papaya', 'Antelope', 'Parrot', 'Seal',
54
+ 'Butterfly', 'Dumbbell', 'Donkey', 'Lion', 'Urinal', 'Dolphin', 'Electric Drill', 'Hair Dryer', 'Egg tart',
55
+ 'Jellyfish', 'Treadmill', 'Lighter', 'Grapefruit', 'Game board', 'Mop', 'Radish', 'Baozi', 'Target', 'French',
56
+ 'Spring Rolls', 'Monkey', 'Rabbit', 'Pencil Case', 'Yak', 'Red Cabbage', 'Binoculars', 'Asparagus', 'Barbell',
57
+ 'Scallop', 'Noddles', 'Comb', 'Dumpling', 'Oyster', 'Table Tennis paddle', 'Cosmetics Brush/Eyeliner Pencil',
58
+ 'Chainsaw', 'Eraser', 'Lobster', 'Durian', 'Okra', 'Lipstick', 'Cosmetics Mirror', 'Curling', 'Table Tennis']
59
+
60
+
61
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
62
+ download: |
63
+ from tqdm import tqdm
64
+
65
+ from utils.general import Path, check_requirements, download, np, xyxy2xywhn
66
+
67
+ check_requirements(('pycocotools>=2.0',))
68
+ from pycocotools.coco import COCO
69
+
70
+ # Make Directories
71
+ dir = Path(yaml['path']) # dataset root dir
72
+ for p in 'images', 'labels':
73
+ (dir / p).mkdir(parents=True, exist_ok=True)
74
+ for q in 'train', 'val':
75
+ (dir / p / q).mkdir(parents=True, exist_ok=True)
76
+
77
+ # Train, Val Splits
78
+ for split, patches in [('train', 50 + 1), ('val', 43 + 1)]:
79
+ print(f"Processing {split} in {patches} patches ...")
80
+ images, labels = dir / 'images' / split, dir / 'labels' / split
81
+
82
+ # Download
83
+ url = f"https://dorc.ks3-cn-beijing.ksyun.com/data-set/2020Objects365%E6%95%B0%E6%8D%AE%E9%9B%86/{split}/"
84
+ if split == 'train':
85
+ download([f'{url}zhiyuan_objv2_{split}.tar.gz'], dir=dir, delete=False) # annotations json
86
+ download([f'{url}patch{i}.tar.gz' for i in range(patches)], dir=images, curl=True, delete=False, threads=8)
87
+ elif split == 'val':
88
+ download([f'{url}zhiyuan_objv2_{split}.json'], dir=dir, delete=False) # annotations json
89
+ download([f'{url}images/v1/patch{i}.tar.gz' for i in range(15 + 1)], dir=images, curl=True, delete=False, threads=8)
90
+ download([f'{url}images/v2/patch{i}.tar.gz' for i in range(16, patches)], dir=images, curl=True, delete=False, threads=8)
91
+
92
+ # Move
93
+ for f in tqdm(images.rglob('*.jpg'), desc=f'Moving {split} images'):
94
+ f.rename(images / f.name) # move to /images/{split}
95
+
96
+ # Labels
97
+ coco = COCO(dir / f'zhiyuan_objv2_{split}.json')
98
+ names = [x["name"] for x in coco.loadCats(coco.getCatIds())]
99
+ for cid, cat in enumerate(names):
100
+ catIds = coco.getCatIds(catNms=[cat])
101
+ imgIds = coco.getImgIds(catIds=catIds)
102
+ for im in tqdm(coco.loadImgs(imgIds), desc=f'Class {cid + 1}/{len(names)} {cat}'):
103
+ width, height = im["width"], im["height"]
104
+ path = Path(im["file_name"]) # image filename
105
+ try:
106
+ with open(labels / path.with_suffix('.txt').name, 'a') as file:
107
+ annIds = coco.getAnnIds(imgIds=im["id"], catIds=catIds, iscrowd=None)
108
+ for a in coco.loadAnns(annIds):
109
+ x, y, w, h = a['bbox'] # bounding box in xywh (xy top-left corner)
110
+ xyxy = np.array([x, y, x + w, y + h])[None] # pixels(1,4)
111
+ x, y, w, h = xyxy2xywhn(xyxy, w=width, h=height, clip=True)[0] # normalized and clipped
112
+ file.write(f"{cid} {x:.5f} {y:.5f} {w:.5f} {h:.5f}\n")
113
+ except Exception as e:
114
+ print(e)
yolov5/data/SKU-110K.yaml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # SKU-110K retail items dataset https://github.com/eg4000/SKU110K_CVPR19 by Trax Retail
3
+ # Example usage: python train.py --data SKU-110K.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── SKU-110K ← downloads here (13.6 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/SKU-110K # dataset root dir
12
+ train: train.txt # train images (relative to 'path') 8219 images
13
+ val: val.txt # val images (relative to 'path') 588 images
14
+ test: test.txt # test images (optional) 2936 images
15
+
16
+ # Classes
17
+ nc: 1 # number of classes
18
+ names: ['object'] # class names
19
+
20
+
21
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
22
+ download: |
23
+ import shutil
24
+ from tqdm import tqdm
25
+ from utils.general import np, pd, Path, download, xyxy2xywh
26
+
27
+
28
+ # Download
29
+ dir = Path(yaml['path']) # dataset root dir
30
+ parent = Path(dir.parent) # download dir
31
+ urls = ['http://trax-geometry.s3.amazonaws.com/cvpr_challenge/SKU110K_fixed.tar.gz']
32
+ download(urls, dir=parent, delete=False)
33
+
34
+ # Rename directories
35
+ if dir.exists():
36
+ shutil.rmtree(dir)
37
+ (parent / 'SKU110K_fixed').rename(dir) # rename dir
38
+ (dir / 'labels').mkdir(parents=True, exist_ok=True) # create labels dir
39
+
40
+ # Convert labels
41
+ names = 'image', 'x1', 'y1', 'x2', 'y2', 'class', 'image_width', 'image_height' # column names
42
+ for d in 'annotations_train.csv', 'annotations_val.csv', 'annotations_test.csv':
43
+ x = pd.read_csv(dir / 'annotations' / d, names=names).values # annotations
44
+ images, unique_images = x[:, 0], np.unique(x[:, 0])
45
+ with open((dir / d).with_suffix('.txt').__str__().replace('annotations_', ''), 'w') as f:
46
+ f.writelines(f'./images/{s}\n' for s in unique_images)
47
+ for im in tqdm(unique_images, desc=f'Converting {dir / d}'):
48
+ cls = 0 # single-class dataset
49
+ with open((dir / 'labels' / im).with_suffix('.txt'), 'a') as f:
50
+ for r in x[images == im]:
51
+ w, h = r[6], r[7] # image width, height
52
+ xywh = xyxy2xywh(np.array([[r[1] / w, r[2] / h, r[3] / w, r[4] / h]]))[0] # instance
53
+ f.write(f"{cls} {xywh[0]:.5f} {xywh[1]:.5f} {xywh[2]:.5f} {xywh[3]:.5f}\n") # write label
yolov5/data/VOC.yaml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC by University of Oxford
3
+ # Example usage: python train.py --data VOC.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── VOC ← downloads here (2.8 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/VOC
12
+ train: # train images (relative to 'path') 16551 images
13
+ - images/train2012
14
+ - images/train2007
15
+ - images/val2012
16
+ - images/val2007
17
+ val: # val images (relative to 'path') 4952 images
18
+ - images/test2007
19
+ test: # test images (optional)
20
+ - images/test2007
21
+
22
+ # Classes
23
+ nc: 20 # number of classes
24
+ names: ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog',
25
+ 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'] # class names
26
+
27
+
28
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
29
+ download: |
30
+ import xml.etree.ElementTree as ET
31
+
32
+ from tqdm import tqdm
33
+ from utils.general import download, Path
34
+
35
+
36
+ def convert_label(path, lb_path, year, image_id):
37
+ def convert_box(size, box):
38
+ dw, dh = 1. / size[0], 1. / size[1]
39
+ x, y, w, h = (box[0] + box[1]) / 2.0 - 1, (box[2] + box[3]) / 2.0 - 1, box[1] - box[0], box[3] - box[2]
40
+ return x * dw, y * dh, w * dw, h * dh
41
+
42
+ in_file = open(path / f'VOC{year}/Annotations/{image_id}.xml')
43
+ out_file = open(lb_path, 'w')
44
+ tree = ET.parse(in_file)
45
+ root = tree.getroot()
46
+ size = root.find('size')
47
+ w = int(size.find('width').text)
48
+ h = int(size.find('height').text)
49
+
50
+ for obj in root.iter('object'):
51
+ cls = obj.find('name').text
52
+ if cls in yaml['names'] and not int(obj.find('difficult').text) == 1:
53
+ xmlbox = obj.find('bndbox')
54
+ bb = convert_box((w, h), [float(xmlbox.find(x).text) for x in ('xmin', 'xmax', 'ymin', 'ymax')])
55
+ cls_id = yaml['names'].index(cls) # class id
56
+ out_file.write(" ".join([str(a) for a in (cls_id, *bb)]) + '\n')
57
+
58
+
59
+ # Download
60
+ dir = Path(yaml['path']) # dataset root dir
61
+ url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/'
62
+ urls = [f'{url}VOCtrainval_06-Nov-2007.zip', # 446MB, 5012 images
63
+ f'{url}VOCtest_06-Nov-2007.zip', # 438MB, 4953 images
64
+ f'{url}VOCtrainval_11-May-2012.zip'] # 1.95GB, 17126 images
65
+ download(urls, dir=dir / 'images', delete=False, curl=True, threads=3)
66
+
67
+ # Convert
68
+ path = dir / 'images/VOCdevkit'
69
+ for year, image_set in ('2012', 'train'), ('2012', 'val'), ('2007', 'train'), ('2007', 'val'), ('2007', 'test'):
70
+ imgs_path = dir / 'images' / f'{image_set}{year}'
71
+ lbs_path = dir / 'labels' / f'{image_set}{year}'
72
+ imgs_path.mkdir(exist_ok=True, parents=True)
73
+ lbs_path.mkdir(exist_ok=True, parents=True)
74
+
75
+ with open(path / f'VOC{year}/ImageSets/Main/{image_set}.txt') as f:
76
+ image_ids = f.read().strip().split()
77
+ for id in tqdm(image_ids, desc=f'{image_set}{year}'):
78
+ f = path / f'VOC{year}/JPEGImages/{id}.jpg' # old img path
79
+ lb_path = (lbs_path / f.name).with_suffix('.txt') # new label path
80
+ f.rename(imgs_path / f.name) # move image
81
+ convert_label(path, lb_path, year, id) # convert labels to YOLO format
yolov5/data/VisDrone.yaml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset by Tianjin University
3
+ # Example usage: python train.py --data VisDrone.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── VisDrone ← downloads here (2.3 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/VisDrone # dataset root dir
12
+ train: VisDrone2019-DET-train/images # train images (relative to 'path') 6471 images
13
+ val: VisDrone2019-DET-val/images # val images (relative to 'path') 548 images
14
+ test: VisDrone2019-DET-test-dev/images # test images (optional) 1610 images
15
+
16
+ # Classes
17
+ nc: 10 # number of classes
18
+ names: ['pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', 'awning-tricycle', 'bus', 'motor']
19
+
20
+
21
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
22
+ download: |
23
+ from utils.general import download, os, Path
24
+
25
+ def visdrone2yolo(dir):
26
+ from PIL import Image
27
+ from tqdm import tqdm
28
+
29
+ def convert_box(size, box):
30
+ # Convert VisDrone box to YOLO xywh box
31
+ dw = 1. / size[0]
32
+ dh = 1. / size[1]
33
+ return (box[0] + box[2] / 2) * dw, (box[1] + box[3] / 2) * dh, box[2] * dw, box[3] * dh
34
+
35
+ (dir / 'labels').mkdir(parents=True, exist_ok=True) # make labels directory
36
+ pbar = tqdm((dir / 'annotations').glob('*.txt'), desc=f'Converting {dir}')
37
+ for f in pbar:
38
+ img_size = Image.open((dir / 'images' / f.name).with_suffix('.jpg')).size
39
+ lines = []
40
+ with open(f, 'r') as file: # read annotation.txt
41
+ for row in [x.split(',') for x in file.read().strip().splitlines()]:
42
+ if row[4] == '0': # VisDrone 'ignored regions' class 0
43
+ continue
44
+ cls = int(row[5]) - 1
45
+ box = convert_box(img_size, tuple(map(int, row[:4])))
46
+ lines.append(f"{cls} {' '.join(f'{x:.6f}' for x in box)}\n")
47
+ with open(str(f).replace(os.sep + 'annotations' + os.sep, os.sep + 'labels' + os.sep), 'w') as fl:
48
+ fl.writelines(lines) # write label.txt
49
+
50
+
51
+ # Download
52
+ dir = Path(yaml['path']) # dataset root dir
53
+ urls = ['https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-train.zip',
54
+ 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-val.zip',
55
+ 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-test-dev.zip',
56
+ 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-test-challenge.zip']
57
+ download(urls, dir=dir, curl=True, threads=4)
58
+
59
+ # Convert
60
+ for d in 'VisDrone2019-DET-train', 'VisDrone2019-DET-val', 'VisDrone2019-DET-test-dev':
61
+ visdrone2yolo(dir / d) # convert VisDrone annotations to YOLO labels
yolov5/data/coco.yaml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # COCO 2017 dataset http://cocodataset.org by Microsoft
3
+ # Example usage: python train.py --data coco.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── coco ← downloads here (20.1 GB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/coco # dataset root dir
12
+ train: train2017.txt # train images (relative to 'path') 118287 images
13
+ val: val2017.txt # val images (relative to 'path') 5000 images
14
+ test: test-dev2017.txt # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794
15
+
16
+ # Classes
17
+ nc: 80 # number of classes
18
+ names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
19
+ 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
20
+ 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
21
+ 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
22
+ 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
23
+ 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
24
+ 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
25
+ 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
26
+ 'hair drier', 'toothbrush'] # class names
27
+
28
+
29
+ # Download script/URL (optional)
30
+ download: |
31
+ from utils.general import download, Path
32
+
33
+
34
+ # Download labels
35
+ segments = False # segment or box labels
36
+ dir = Path(yaml['path']) # dataset root dir
37
+ url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/'
38
+ urls = [url + ('coco2017labels-segments.zip' if segments else 'coco2017labels.zip')] # labels
39
+ download(urls, dir=dir.parent)
40
+
41
+ # Download data
42
+ urls = ['http://images.cocodataset.org/zips/train2017.zip', # 19G, 118k images
43
+ 'http://images.cocodataset.org/zips/val2017.zip', # 1G, 5k images
44
+ 'http://images.cocodataset.org/zips/test2017.zip'] # 7G, 41k images (optional)
45
+ download(urls, dir=dir / 'images', threads=3)
yolov5/data/coco128.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
3
+ # Example usage: python train.py --data coco128.yaml
4
+ # parent
5
+ # β”œβ”€β”€ yolov5
6
+ # └── datasets
7
+ # └── coco128 ← downloads here (7 MB)
8
+
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/coco128 # dataset root dir
12
+ train: images/train2017 # train images (relative to 'path') 128 images
13
+ val: images/train2017 # val images (relative to 'path') 128 images
14
+ test: # test images (optional)
15
+
16
+ # Classes
17
+ nc: 80 # number of classes
18
+ names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
19
+ 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
20
+ 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
21
+ 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
22
+ 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
23
+ 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
24
+ 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
25
+ 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
26
+ 'hair drier', 'toothbrush'] # class names
27
+
28
+
29
+ # Download script/URL (optional)
30
+ download: https://ultralytics.com/assets/coco128.zip
yolov5/data/hyps/hyp.Objects365.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for Objects365 training
3
+ # python train.py --weights yolov5m.pt --data Objects365.yaml --evolve
4
+ # See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ lr0: 0.00258
7
+ lrf: 0.17
8
+ momentum: 0.779
9
+ weight_decay: 0.00058
10
+ warmup_epochs: 1.33
11
+ warmup_momentum: 0.86
12
+ warmup_bias_lr: 0.0711
13
+ box: 0.0539
14
+ cls: 0.299
15
+ cls_pw: 0.825
16
+ obj: 0.632
17
+ obj_pw: 1.0
18
+ iou_t: 0.2
19
+ anchor_t: 3.44
20
+ anchors: 3.2
21
+ fl_gamma: 0.0
22
+ hsv_h: 0.0188
23
+ hsv_s: 0.704
24
+ hsv_v: 0.36
25
+ degrees: 0.0
26
+ translate: 0.0902
27
+ scale: 0.491
28
+ shear: 0.0
29
+ perspective: 0.0
30
+ flipud: 0.0
31
+ fliplr: 0.5
32
+ mosaic: 1.0
33
+ mixup: 0.0
34
+ copy_paste: 0.0
yolov5/data/hyps/hyp.VOC.yaml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for VOC training
3
+ # python train.py --batch 128 --weights yolov5m6.pt --data VOC.yaml --epochs 50 --img 512 --hyp hyp.scratch-med.yaml --evolve
4
+ # See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ # YOLOv5 Hyperparameter Evolution Results
7
+ # Best generation: 467
8
+ # Last generation: 996
9
+ # metrics/precision, metrics/recall, metrics/mAP_0.5, metrics/mAP_0.5:0.95, val/box_loss, val/obj_loss, val/cls_loss
10
+ # 0.87729, 0.85125, 0.91286, 0.72664, 0.0076739, 0.0042529, 0.0013865
11
+
12
+ lr0: 0.00334
13
+ lrf: 0.15135
14
+ momentum: 0.74832
15
+ weight_decay: 0.00025
16
+ warmup_epochs: 3.3835
17
+ warmup_momentum: 0.59462
18
+ warmup_bias_lr: 0.18657
19
+ box: 0.02
20
+ cls: 0.21638
21
+ cls_pw: 0.5
22
+ obj: 0.51728
23
+ obj_pw: 0.67198
24
+ iou_t: 0.2
25
+ anchor_t: 3.3744
26
+ fl_gamma: 0.0
27
+ hsv_h: 0.01041
28
+ hsv_s: 0.54703
29
+ hsv_v: 0.27739
30
+ degrees: 0.0
31
+ translate: 0.04591
32
+ scale: 0.75544
33
+ shear: 0.0
34
+ perspective: 0.0
35
+ flipud: 0.0
36
+ fliplr: 0.5
37
+ mosaic: 0.85834
38
+ mixup: 0.04266
39
+ copy_paste: 0.0
40
+ anchors: 3.412
yolov5/data/hyps/hyp.scratch-high.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for high-augmentation COCO training from scratch
3
+ # python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300
4
+ # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
+ lrf: 0.1 # final OneCycleLR learning rate (lr0 * lrf)
8
+ momentum: 0.937 # SGD momentum/Adam beta1
9
+ weight_decay: 0.0005 # optimizer weight decay 5e-4
10
+ warmup_epochs: 3.0 # warmup epochs (fractions ok)
11
+ warmup_momentum: 0.8 # warmup initial momentum
12
+ warmup_bias_lr: 0.1 # warmup initial bias lr
13
+ box: 0.05 # box loss gain
14
+ cls: 0.3 # cls loss gain
15
+ cls_pw: 1.0 # cls BCELoss positive_weight
16
+ obj: 0.7 # obj loss gain (scale with pixels)
17
+ obj_pw: 1.0 # obj BCELoss positive_weight
18
+ iou_t: 0.20 # IoU training threshold
19
+ anchor_t: 4.0 # anchor-multiple threshold
20
+ # anchors: 3 # anchors per output layer (0 to ignore)
21
+ fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
22
+ hsv_h: 0.015 # image HSV-Hue augmentation (fraction)
23
+ hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
24
+ hsv_v: 0.4 # image HSV-Value augmentation (fraction)
25
+ degrees: 0.0 # image rotation (+/- deg)
26
+ translate: 0.1 # image translation (+/- fraction)
27
+ scale: 0.9 # image scale (+/- gain)
28
+ shear: 0.0 # image shear (+/- deg)
29
+ perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
30
+ flipud: 0.0 # image flip up-down (probability)
31
+ fliplr: 0.5 # image flip left-right (probability)
32
+ mosaic: 1.0 # image mosaic (probability)
33
+ mixup: 0.1 # image mixup (probability)
34
+ copy_paste: 0.1 # segment copy-paste (probability)
yolov5/data/hyps/hyp.scratch-low.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for low-augmentation COCO training from scratch
3
+ # python train.py --batch 64 --cfg yolov5n6.yaml --weights '' --data coco.yaml --img 640 --epochs 300 --linear
4
+ # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
+ lrf: 0.01 # final OneCycleLR learning rate (lr0 * lrf)
8
+ momentum: 0.937 # SGD momentum/Adam beta1
9
+ weight_decay: 0.0005 # optimizer weight decay 5e-4
10
+ warmup_epochs: 3.0 # warmup epochs (fractions ok)
11
+ warmup_momentum: 0.8 # warmup initial momentum
12
+ warmup_bias_lr: 0.1 # warmup initial bias lr
13
+ box: 0.05 # box loss gain
14
+ cls: 0.5 # cls loss gain
15
+ cls_pw: 1.0 # cls BCELoss positive_weight
16
+ obj: 1.0 # obj loss gain (scale with pixels)
17
+ obj_pw: 1.0 # obj BCELoss positive_weight
18
+ iou_t: 0.20 # IoU training threshold
19
+ anchor_t: 4.0 # anchor-multiple threshold
20
+ # anchors: 3 # anchors per output layer (0 to ignore)
21
+ fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
22
+ hsv_h: 0.015 # image HSV-Hue augmentation (fraction)
23
+ hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
24
+ hsv_v: 0.4 # image HSV-Value augmentation (fraction)
25
+ degrees: 0.0 # image rotation (+/- deg)
26
+ translate: 0.1 # image translation (+/- fraction)
27
+ scale: 0.5 # image scale (+/- gain)
28
+ shear: 0.0 # image shear (+/- deg)
29
+ perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
30
+ flipud: 0.0 # image flip up-down (probability)
31
+ fliplr: 0.5 # image flip left-right (probability)
32
+ mosaic: 1.0 # image mosaic (probability)
33
+ mixup: 0.0 # image mixup (probability)
34
+ copy_paste: 0.0 # segment copy-paste (probability)
yolov5/data/hyps/hyp.scratch-med.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for medium-augmentation COCO training from scratch
3
+ # python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300
4
+ # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
+ lrf: 0.1 # final OneCycleLR learning rate (lr0 * lrf)
8
+ momentum: 0.937 # SGD momentum/Adam beta1
9
+ weight_decay: 0.0005 # optimizer weight decay 5e-4
10
+ warmup_epochs: 3.0 # warmup epochs (fractions ok)
11
+ warmup_momentum: 0.8 # warmup initial momentum
12
+ warmup_bias_lr: 0.1 # warmup initial bias lr
13
+ box: 0.05 # box loss gain
14
+ cls: 0.3 # cls loss gain
15
+ cls_pw: 1.0 # cls BCELoss positive_weight
16
+ obj: 0.7 # obj loss gain (scale with pixels)
17
+ obj_pw: 1.0 # obj BCELoss positive_weight
18
+ iou_t: 0.20 # IoU training threshold
19
+ anchor_t: 4.0 # anchor-multiple threshold
20
+ # anchors: 3 # anchors per output layer (0 to ignore)
21
+ fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
22
+ hsv_h: 0.015 # image HSV-Hue augmentation (fraction)
23
+ hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
24
+ hsv_v: 0.4 # image HSV-Value augmentation (fraction)
25
+ degrees: 0.0 # image rotation (+/- deg)
26
+ translate: 0.1 # image translation (+/- fraction)
27
+ scale: 0.9 # image scale (+/- gain)
28
+ shear: 0.0 # image shear (+/- deg)
29
+ perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
30
+ flipud: 0.0 # image flip up-down (probability)
31
+ fliplr: 0.5 # image flip left-right (probability)
32
+ mosaic: 1.0 # image mosaic (probability)
33
+ mixup: 0.1 # image mixup (probability)
34
+ copy_paste: 0.0 # segment copy-paste (probability)
yolov5/data/images/bus.jpg ADDED
yolov5/data/images/zidane.jpg ADDED
yolov5/data/scripts/download_weights.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
3
+ # Download latest models from https://github.com/ultralytics/yolov5/releases
4
+ # Example usage: bash path/to/download_weights.sh
5
+ # parent
6
+ # └── yolov5
7
+ # β”œβ”€β”€ yolov5s.pt ← downloads here
8
+ # β”œβ”€β”€ yolov5m.pt
9
+ # └── ...
10
+
11
+ python - <<EOF
12
+ from utils.downloads import attempt_download
13
+
14
+ models = ['n', 's', 'm', 'l', 'x']
15
+ models.extend([x + '6' for x in models]) # add P6 models
16
+
17
+ for x in models:
18
+ attempt_download(f'yolov5{x}.pt')
19
+
20
+ EOF
yolov5/data/scripts/get_coco.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
3
+ # Download COCO 2017 dataset http://cocodataset.org
4
+ # Example usage: bash data/scripts/get_coco.sh
5
+ # parent
6
+ # β”œβ”€β”€ yolov5
7
+ # └── datasets
8
+ # └── coco ← downloads here
9
+
10
+ # Download/unzip labels
11
+ d='../datasets' # unzip directory
12
+ url=https://github.com/ultralytics/yolov5/releases/download/v1.0/
13
+ f='coco2017labels.zip' # or 'coco2017labels-segments.zip', 68 MB
14
+ echo 'Downloading' $url$f ' ...'
15
+ curl -L $url$f -o $f && unzip -q $f -d $d && rm $f &
16
+
17
+ # Download/unzip images
18
+ d='../datasets/coco/images' # unzip directory
19
+ url=http://images.cocodataset.org/zips/
20
+ f1='train2017.zip' # 19G, 118k images
21
+ f2='val2017.zip' # 1G, 5k images
22
+ f3='test2017.zip' # 7G, 41k images (optional)
23
+ for f in $f1 $f2; do
24
+ echo 'Downloading' $url$f '...'
25
+ curl -L $url$f -o $f && unzip -q $f -d $d && rm $f &
26
+ done
27
+ wait # finish background tasks
yolov5/data/scripts/get_coco128.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
3
+ # Download COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017)
4
+ # Example usage: bash data/scripts/get_coco128.sh
5
+ # parent
6
+ # β”œβ”€β”€ yolov5
7
+ # └── datasets
8
+ # └── coco128 ← downloads here
9
+
10
+ # Download/unzip images and labels
11
+ d='../datasets' # unzip directory
12
+ url=https://github.com/ultralytics/yolov5/releases/download/v1.0/
13
+ f='coco128.zip' # or 'coco128-segments.zip', 68 MB
14
+ echo 'Downloading' $url$f ' ...'
15
+ curl -L $url$f -o $f && unzip -q $f -d $d && rm $f &
16
+
17
+ wait # finish background tasks
yolov5/data/xView.yaml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # DIUx xView 2018 Challenge https://challenge.xviewdataset.org by U.S. National Geospatial-Intelligence Agency (NGA)
3
+ # -------- DOWNLOAD DATA MANUALLY and jar xf val_images.zip to 'datasets/xView' before running train command! --------
4
+ # Example usage: python train.py --data xView.yaml
5
+ # parent
6
+ # β”œβ”€β”€ yolov5
7
+ # └── datasets
8
+ # └── xView ← downloads here (20.7 GB)
9
+
10
+
11
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
12
+ path: ../datasets/xView # dataset root dir
13
+ train: images/autosplit_train.txt # train images (relative to 'path') 90% of 847 train images
14
+ val: images/autosplit_val.txt # train images (relative to 'path') 10% of 847 train images
15
+
16
+ # Classes
17
+ nc: 60 # number of classes
18
+ names: ['Fixed-wing Aircraft', 'Small Aircraft', 'Cargo Plane', 'Helicopter', 'Passenger Vehicle', 'Small Car', 'Bus',
19
+ 'Pickup Truck', 'Utility Truck', 'Truck', 'Cargo Truck', 'Truck w/Box', 'Truck Tractor', 'Trailer',
20
+ 'Truck w/Flatbed', 'Truck w/Liquid', 'Crane Truck', 'Railway Vehicle', 'Passenger Car', 'Cargo Car',
21
+ 'Flat Car', 'Tank car', 'Locomotive', 'Maritime Vessel', 'Motorboat', 'Sailboat', 'Tugboat', 'Barge',
22
+ 'Fishing Vessel', 'Ferry', 'Yacht', 'Container Ship', 'Oil Tanker', 'Engineering Vehicle', 'Tower crane',
23
+ 'Container Crane', 'Reach Stacker', 'Straddle Carrier', 'Mobile Crane', 'Dump Truck', 'Haul Truck',
24
+ 'Scraper/Tractor', 'Front loader/Bulldozer', 'Excavator', 'Cement Mixer', 'Ground Grader', 'Hut/Tent', 'Shed',
25
+ 'Building', 'Aircraft Hangar', 'Damaged Building', 'Facility', 'Construction Site', 'Vehicle Lot', 'Helipad',
26
+ 'Storage Tank', 'Shipping container lot', 'Shipping Container', 'Pylon', 'Tower'] # class names
27
+
28
+
29
+ # Download script/URL (optional) ---------------------------------------------------------------------------------------
30
+ download: |
31
+ import json
32
+ import os
33
+ from pathlib import Path
34
+
35
+ import numpy as np
36
+ from PIL import Image
37
+ from tqdm import tqdm
38
+
39
+ from utils.datasets import autosplit
40
+ from utils.general import download, xyxy2xywhn
41
+
42
+
43
+ def convert_labels(fname=Path('xView/xView_train.geojson')):
44
+ # Convert xView geoJSON labels to YOLO format
45
+ path = fname.parent
46
+ with open(fname) as f:
47
+ print(f'Loading {fname}...')
48
+ data = json.load(f)
49
+
50
+ # Make dirs
51
+ labels = Path(path / 'labels' / 'train')
52
+ os.system(f'rm -rf {labels}')
53
+ labels.mkdir(parents=True, exist_ok=True)
54
+
55
+ # xView classes 11-94 to 0-59
56
+ xview_class2index = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, 8, -1, 9, 10, 11,
57
+ 12, 13, 14, 15, -1, -1, 16, 17, 18, 19, 20, 21, 22, -1, 23, 24, 25, -1, 26, 27, -1, 28, -1,
58
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, 38, 39, 40, 41, 42, 43, 44, 45, -1, -1, -1, -1, 46,
59
+ 47, 48, 49, -1, 50, 51, -1, 52, -1, -1, -1, 53, 54, -1, 55, -1, -1, 56, -1, 57, -1, 58, 59]
60
+
61
+ shapes = {}
62
+ for feature in tqdm(data['features'], desc=f'Converting {fname}'):
63
+ p = feature['properties']
64
+ if p['bounds_imcoords']:
65
+ id = p['image_id']
66
+ file = path / 'train_images' / id
67
+ if file.exists(): # 1395.tif missing
68
+ try:
69
+ box = np.array([int(num) for num in p['bounds_imcoords'].split(",")])
70
+ assert box.shape[0] == 4, f'incorrect box shape {box.shape[0]}'
71
+ cls = p['type_id']
72
+ cls = xview_class2index[int(cls)] # xView class to 0-60
73
+ assert 59 >= cls >= 0, f'incorrect class index {cls}'
74
+
75
+ # Write YOLO label
76
+ if id not in shapes:
77
+ shapes[id] = Image.open(file).size
78
+ box = xyxy2xywhn(box[None].astype(np.float), w=shapes[id][0], h=shapes[id][1], clip=True)
79
+ with open((labels / id).with_suffix('.txt'), 'a') as f:
80
+ f.write(f"{cls} {' '.join(f'{x:.6f}' for x in box[0])}\n") # write label.txt
81
+ except Exception as e:
82
+ print(f'WARNING: skipping one label for {file}: {e}')
83
+
84
+
85
+ # Download manually from https://challenge.xviewdataset.org
86
+ dir = Path(yaml['path']) # dataset root dir
87
+ # urls = ['https://d307kc0mrhucc3.cloudfront.net/train_labels.zip', # train labels
88
+ # 'https://d307kc0mrhucc3.cloudfront.net/train_images.zip', # 15G, 847 train images
89
+ # 'https://d307kc0mrhucc3.cloudfront.net/val_images.zip'] # 5G, 282 val images (no labels)
90
+ # download(urls, dir=dir, delete=False)
91
+
92
+ # Convert labels
93
+ convert_labels(dir / 'xView_train.geojson')
94
+
95
+ # Move images
96
+ images = Path(dir / 'images')
97
+ images.mkdir(parents=True, exist_ok=True)
98
+ Path(dir / 'train_images').rename(dir / 'images' / 'train')
99
+ Path(dir / 'val_images').rename(dir / 'images' / 'val')
100
+
101
+ # Split
102
+ autosplit(dir / 'images' / 'train')