Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to ultralytics 16.09.22 #146

Merged
merged 31 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 31 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,62 +19,75 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Restore Ubuntu cache
uses: actions/cache@v1
if: matrix.operating-system == 'ubuntu-latest'
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Restore MacOS cache
uses: actions/cache@v1
if: matrix.operating-system == 'macos-latest'
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Restore Windows cache
uses: actions/cache@v1
if: matrix.operating-system == 'windows-latest'
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Update pip
run: python -m pip install --upgrade pip
- name: Install numpy and matplotlib for Python 3.6
if: matrix.python-version == 3.6
run: >
pip install "numpy>=1.18.5,<1.20" "matplotlib>=3.2.2,<4"

- name: Install dependencies
run: >
pip install -r requirements.txt

- name: Test with unittest
run: |
python -m unittest

- name: Test scripts
run: |
pip install -e .
di=cpu # inference devices # define device
# train
python yolov5/train.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di --evolve 2
python yolov5/train.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu --freeze 10
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu --evolve 2
# detect
python yolov5/detect.py --weights yolov5/weights/yolov5n.pt --device $di
yolov5 detect --weights yolov5/weights/yolov5n.pt --device $di
python yolov5/detect.py --weights runs/train/exp/weights/last.pt --device $di
yolov5 detect --weights runs/train/exp/weights/last.pt --device $di
python yolov5/detect.py --weights yolov5/weights/yolov5n.pt --device cpu
yolov5 detect --weights yolov5/weights/yolov5n.pt --device cpu
python yolov5/detect.py --weights runs/train/exp/weights/last.pt --device cpu
yolov5 detect --weights runs/train/exp/weights/last.pt --device cpu
# val
python yolov5/val.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device $di
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device $di
python yolov5/val.py --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device $di
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device $di
python yolov5/val.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device cpu
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device cpu
python yolov5/val.py --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device cpu
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device cpu
# export
pip install onnx onnx-simplifier tensorflowjs
python yolov5/export.py --weights yolov5/weights/yolov5n.pt --device $di --include 'torchscript,onnx,tflite'
yolov5 export --weights yolov5/weights/yolov5n.pt --device $di --simplify --include torchscript,onnx,saved_model,pb,tfjs
python yolov5/export.py --weights yolov5/weights/yolov5n.pt --device cpu --include torchscript,onnx,tflite
yolov5 export --weights yolov5/weights/yolov5n.pt --device cpu --simplify --include torchscript,onnx,saved_model,pb,tfjs
# benckmarks
yolov5 benchmarks --weights yolov5s.pt --img 128 --pt-only --device cpu
# classify
yolov5 classify train --img 32 --data mnist2560 --weights yolov5s-cls.pt --epochs 1 --device cpu
yolov5 classify val --img 32 --data datasets/mnist2560 --weights yolov5s-cls.pt --device cpu
yolov5 classify predict --img 32 --weights yolov5s-cls.pt --device cpu
# segment
yolov5 segment train --img 128 --weights yolov5s-seg.pt --epochs 1 --device cpu
# yolov5 segment val --img 128 --weights yolov5s-seg.pt --device cpu
yolov5 segment predict --img 128 --weights yolov5s-seg.pt --device cpu
50 changes: 32 additions & 18 deletions .github/workflows/package_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,62 +17,76 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Restore Ubuntu cache
uses: actions/cache@v1
if: matrix.operating-system == 'ubuntu-latest'
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Restore MacOS cache
uses: actions/cache@v1
if: matrix.operating-system == 'macos-latest'
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Restore Windows cache
uses: actions/cache@v1
if: matrix.operating-system == 'windows-latest'
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-

- name: Update pip
run: python -m pip install --upgrade pip
- name: Install numpy and matplotlib for Python 3.6
if: matrix.python-version == 3.6
run: >
pip install "numpy>=1.18.5,<1.20" "matplotlib>=3.2.2,<4"


- name: Install latest YOLOv5 package
run: >
pip install --upgrade --force-reinstall yolov5

- name: Test with unittest
run: |
python -m unittest

- name: Test scripts
run: |
pip install -e .
di=cpu # inference devices # define device
# train
python yolov5/train.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device $di --evolve 2
python yolov5/train.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu --freeze 10
yolov5 train --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --epochs 1 --device cpu --evolve 2
# detect
python yolov5/detect.py --weights yolov5/weights/yolov5n.pt --device $di
yolov5 detect --weights yolov5/weights/yolov5n.pt --device $di
python yolov5/detect.py --weights runs/train/exp/weights/last.pt --device $di
yolov5 detect --weights runs/train/exp/weights/last.pt --device $di
python yolov5/detect.py --weights yolov5/weights/yolov5n.pt --device cpu
yolov5 detect --weights yolov5/weights/yolov5n.pt --device cpu
python yolov5/detect.py --weights runs/train/exp/weights/last.pt --device cpu
yolov5 detect --weights runs/train/exp/weights/last.pt --device cpu
# val
python yolov5/val.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device $di
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device $di
python yolov5/val.py --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device $di
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device $di
python yolov5/val.py --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device cpu
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights yolov5/weights/yolov5n.pt --device cpu
python yolov5/val.py --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device cpu
yolov5 val --data yolov5/data/coco128.yaml --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device cpu
# export
pip install onnx onnx-simplifier tensorflowjs
python yolov5/export.py --weights yolov5/weights/yolov5n.pt --device $di --include 'torchscript,onnx,tflite'
yolov5 export --weights yolov5/weights/yolov5n.pt --device $di --simplify --include torchscript,onnx,saved_model,pb,tfjs
python yolov5/export.py --weights yolov5/weights/yolov5n.pt --device cpu --include torchscript,onnx,tflite
yolov5 export --weights yolov5/weights/yolov5n.pt --device cpu --simplify --include torchscript,onnx,saved_model,pb,tfjs
# benckmarks
yolov5 benchmarks --weights yolov5s.pt --img 128 --pt-only --device cpu
# classify
yolov5 classify train --img 224 --weights yolov5s-cls.pt --epochs 1 --device cpu
yolov5 classify val --img 224 --weights yolov5s-cls.pt --device cpu
yolov5 classify predict --img 224 --weights yolov5s-cls.pt --device cpu
# segment
yolov5 segment train --img 128 --weights yolov5s-seg.pt --epochs 1 --device cpu
# yolov5 segment val --img 128 --weights yolov5s-seg.pt --device cpu
yolov5 segment predict --img 128 --weights yolov5s-seg.pt --device cpu
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ pycocotools/*
results*.txt
gcp_test*.sh
.neptune
*.bin
*.pb
*saved_model
*.zip
datasets/

# Datasets -------------------------------------------------------------------------------------------------------------
coco/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can finally install <a href="https://github.com/ultralytics/yolov5">YOLOv5 o
</div>

<br>
This yolov5 package contains everything from ultralytics/yolov5 <a href="https://github.com/ultralytics/yolov5/tree/84e7748564f83ba04601770f17a38cc55e6be661">at this commit</a> plus:
This yolov5 package contains everything from ultralytics/yolov5 <a href="https://github.com/ultralytics/yolov5/tree/03f2ca8eff8918b98169256d055353a1f15b8e32">at this commit</a> plus:
<br>
1. Easy installation via pip: `pip install yolov5`
<br>
Expand Down
4 changes: 4 additions & 0 deletions data_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
train_json_path: "/home/fatihakyon/data/witwiser/banned_objects_with_negative_samples/train.json"
train_image_dir: "/home/fatihakyon/data/witwiser/banned_objects_with_negative_samples"
val_json_path: "/home/fatihakyon/data/witwiser/banned_objects_with_negative_samples/val.json"
val_image_dir: "/home/fatihakyon/data/witwiser/banned_objects_with_negative_samples"
13 changes: 13 additions & 0 deletions data_wandb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
names:
- earphone
- cable
- cellphone
- Headphone
- calculator
nc: 5
train: wandb-artifact://YOLOv5/train
train_image_dir: /home/fatihakyon/data/witwiser/banned_objects_with_negative_samples
train_json_path: /home/fatihakyon/data/witwiser/banned_objects_with_negative_samples/train.json
val: wandb-artifact://YOLOv5/val
val_image_dir: /home/fatihakyon/data/witwiser/banned_objects_with_negative_samples
val_json_path: /home/fatihakyon/data/witwiser/banned_objects_with_negative_samples/val.json
5 changes: 5 additions & 0 deletions data_yolo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
names: ['earphone', 'cable', 'cellphone', 'Headphone', 'calculator']
nc: 5
train: /home/fatihakyon/dev/fcakyon/yolov5-pip/runs/train/yolo_upload_dataset_test/data/train
val: /home/fatihakyon/dev/fcakyon/yolov5-pip/runs/train/yolo_upload_dataset_test/data/val
yolo_s3_data_dir: s3://obss-ml/computer-vision/model/yolov5/yolo_upload_dataset_test2/data/
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ scipy>=1.4.1
torch>=1.7.0
torchvision>=0.8.1
tqdm>=4.64.0
protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012
# protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012

# Logging -------------------------------------
tensorboard>=2.4.1
# wandb
# clearml

# Plotting ------------------------------------
pandas>=1.1.4
Expand Down Expand Up @@ -46,4 +47,4 @@ fire
# AWS
boto3>=1.19.1
# coco to yolov5 conversion
sahi>=0.9.1
sahi>=0.10.5
2 changes: 1 addition & 1 deletion yolov5/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from yolov5.helpers import YOLOv5
from yolov5.helpers import load_model as load

__version__ = "6.1.9"
__version__ = "6.2.0"
Loading