# training yolov7 notes
```
python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights './yolov7.pt' --name yolov7 --hyp data/hyp.scratch.p5.yaml
調整其中的內容使其可以正確運行
data/coco.yaml <-- 改變資料位置
cfg/training/yolov7.yaml
data/hyp.scratch.p5.yaml
coco.yaml :
train: ../datasets/coco/train2017.txt
val: ../datasets/coco/val2017.txt
test: ../datasets/coco/test-dev2017.txt
```
### issue
```
Transferred 558/566 items from yolov7.pt
Scaled weight_decay = 0.0005
Optimizer groups: 95 .bias, 95 conv.weight, 98 other
Traceback (most recent call last):
File "c:\develop\yolov7\train.py", line 616, in <module>
train(hyp, opt, device, tb_writer)
File "c:\develop\yolov7\train.py", line 245, in train
dataloader, dataset = create_dataloader(train_path, imgsz, batch_size, gs, opt,
File "c:\develop\yolov7\utils\datasets.py", line 69, in create_dataloader
dataset = LoadImagesAndLabels(path, imgsz, batch_size,
File "c:\develop\yolov7\utils\datasets.py", line 392, in __init__
cache, exists = torch.load(cache_path), True # load
File "C:\Users\rchiu\AppData\Roaming\Python\Python310\site-packages\torch\serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\Users\rchiu\AppData\Roaming\Python\Python310\site-packages\torch\serialization.py", line 1033, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: STACK_GLOBAL requires str
### solution from google ###
Try to delete the .cache file in your training or testing path, this works for me.
Image sizes 640 train, 640 test
Using 8 dataloader workers
Logging results to runs\train\yolov75
Starting training for 3 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/2 24.9G 0.0238 0.02475 0.006217 0.05477 488 640: 3%|██▋ | 119/3697 [02:34<1:17:36, 1.30s/it]
```
## 速度效能
```
batch size (worker=8)
32 [02:34<1:17:36, 1.30s/it] -> 1:20
24 [02:11<37:04, 2.11it/s] -> :39.x
28 [03:41<35:04, 1.82it/s] -> :38.x <---
16 [00:57<41:17, 2.92it/s] -> :42
worker (batch size = 28)
8 [09:28<29:13, 1.82it/s] -> :38.x
32 [03:24<35:15, 1.83it/s]
16 [01:49<35:58, 1.87it/s] -> :37.x <---
4 [03:37<34:46, 1.84it/s] -> :38.x
64 [01:51<36:12, 1.86it/s] -> :38.x
128[09:06<29:47, 1.81it/s] -> :38.x
2 [09:20<39:06, 1.50it/s] # GPU明顯利用率降低
```
## 測試
```
python train.py --workers 16 --device 0 --batch-size 28 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --name yolov7 --epochs 2 --weights yolov7.pt
============================================================
Model Summary: 415 layers, 37622682 parameters, 37622682 gradients
Transferred 558/566 items from yolov7.pt
Scaled weight_decay = 0.0004375
Optimizer groups: 95 .bias, 95 conv.weight, 98 other
train: Scanning '..\datasets\coco\train2017.cache' images and labels... 117266 found, 1021 missing, 0 empty, 4 corrupted: 100%|█████████████████████████████████████████████████| 118287/118287 [00:00<?, ?it/s]
val: Scanning '..\datasets\coco\val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100%|█████████████████████████████████████████████████████████████| 5000/5000 [00:00<?, ?it/s]
autoanchor: Analyzing anchors... anchors/target = 4.42, Best Possible Recall (BPR) = 0.9912
Image sizes 640 train, 640 test
Using 16 dataloader workers
Logging results to runs\train\yolov7
Starting training for 2 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/1 21.9G 0.02358 0.02453 0.006068 0.05418 488 640: 6%|█████▎ | 263/4225 [02:27<35:40, 1.85it/s]
```
## tiny測試
```
python train.py --workers 16 --device 0 --batch-size 28 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7-tiny.yaml --name yolov7-tiny --epochs 2 --weights yolov7-tiny.pt
========================================================
Model Summary: 263 layers, 6228762 parameters, 6228762 gradients
Transferred 336/344 items from yolov7-tiny.pt
Scaled weight_decay = 0.0004375
Optimizer groups: 58 .bias, 58 conv.weight, 61 other
train: Scanning '..\datasets\coco\train2017.cache' images and labels... 117266 found, 1021 missing, 0 empty, 4 corrupted: 100%|█████████████████████████████████████████████████| 118287/118287 [00:00<?, ?it/s]
val: Scanning '..\datasets\coco\val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100%|█████████████████████████████████████████████████████████████| 5000/5000 [00:00<?, ?it/s]
autoanchor: Analyzing anchors... anchors/target = 4.45, Best Possible Recall (BPR) = 0.9949
Image sizes 640 train, 640 test
Using 16 dataloader workers
Logging results to runs\train\yolov7-tiny
Starting training for 2 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/1 5.09G 0.03385 0.03187 0.01427 0.07999 434 640: 12%|██████████▎ | 505/4225 [03:12<24:54, 2.49it/s]
python train.py --workers 32 --device 0 --batch-size 64 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7-tiny.yaml --name yolov7-tiny --epochs 2 --weights yolov7-tiny.pt
==================================================
Model Summary: 263 layers, 6228762 parameters, 6228762 gradients
Transferred 336/344 items from yolov7-tiny.pt
Scaled weight_decay = 0.0005
Optimizer groups: 58 .bias, 58 conv.weight, 61 other
train: Scanning '..\datasets\coco\train2017.cache' images and labels... 117266 found, 1021 missing, 0 empty, 4 corrupted: 100%|█████████████████████████████████████████████████| 118287/118287 [00:00<?, ?it/s]
val: Scanning '..\datasets\coco\val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100%|█████████████████████████████████████████████████████████████| 5000/5000 [00:00<?, ?it/s]
autoanchor: Analyzing anchors... anchors/target = 4.45, Best Possible Recall (BPR) = 0.9949
Image sizes 640 train, 640 test
Using 32 dataloader workers
Logging results to runs\train\yolov7-tiny2
Starting training for 2 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/1 12.2G 0.03551 0.03168 0.01401 0.0812 875 640: 25%|█████████████████████▏ | 456/1849 [06:43<20:13, 1.15it/s]
```
## test.py & detect.py
```
python test.py --data data/coco.yaml --img 640 --batch 64 --conf 0.001 --iou 0.65 --device 0 --weights yolov7-tiny.pt --name yolov7_640_val
python detect.py --weights yolov7-tiny.pt --conf 0.25 --img-size 640 --source inference/sample.mp4
python detect.py --weights yolov7-tiny.pt --conf 0.25 --img-size 640 --source 0
```

# custom dataset training
```
file: data/custom.yaml (--data)
train: ../thesis_data/dataset/train/images
val: ../thesis_data/dataset/valid/images
nc: 4
names: ['military aircraft','military ship','military tank','civilianvehicle']
file: cfg/training/yolov7-tiny-custom.yaml
# parameters
nc: 4 # number of classes
file: data/hyp.scratch.custom.yaml (--hyp)
=============================================
python train.py --workers 8 --device 0 --batch-size 64 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-tiny-custom.yaml --weights 'yolov7-tiny.pt' --name yolov7-tiny-custom --hyp data/hyp.scratch.custom.yaml
# 從頭開始
Model Summary: 263 layers, 6023106 parameters, 6023106 gradients
Scaled weight_decay = 0.0005
Optimizer groups: 58 .bias, 58 conv.weight, 61 other
train: Scanning '..\thesis_data\dataset\train\labels.cache' images and labels... 53317 found, 0 missing, 6883 empty, 1 corrupted: 100%|███████████████████████████████████████████| 53317/53317 [00:00<?, ?it/s]
val: Scanning '..\thesis_data\dataset\valid\labels.cache' images and labels... 5609 found, 0 missing, 287 empty, 0 corrupted: 100%|█████████████████████████████████████████████████| 5609/5609 [00:00<?, ?it/s]
autoanchor: Analyzing anchors... anchors/target = 3.57, Best Possible Recall (BPR) = 0.9992
Image sizes 640 train, 640 test
Using 8 dataloader workers
Logging results to runs\train\yolov7-tiny-custom
Starting training for 300 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/299 10.4G 0.07536 0.01434 0.02705 0.1167 165 640: 2%|█▉ | 18/834 [00:14<07:50, 1.73it/s]
Epoch gpu_mem box obj cls total labels img_size
5/299 16G 0.05053 0.008307 0.003781 0.06262 21 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 834/834 [07:24<00:00, 1.87it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 44/44 [00:19<00:00, 2.29it/s]
all 5609 8544 0.668 0.498 0.499 0.25
```
```
python train.py --workers 8 --device 0 --batch-size 64 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-tiny-custom.yaml --weights 'yolov7-tiny.pt' --name yolov7-tiny-custom --hyp data/hyp.scratch.custom.yaml
# --weights 'yolov7-tiny.pt'
Epoch gpu_mem box obj cls total labels img_size
1/299 10G 0.04725 0.007745 0.003344 0.05834 7 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 834/834 [07:40<00:00, 1.81it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 44/44 [00:20<00:00, 2.16it/s]
all 5609 8544 0.624 0.566 0.56 0.292
Epoch gpu_mem box obj cls total labels img_size
6/299 15.6G 0.04507 0.007654 0.002253 0.05497 15 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 834/834 [07:37<00:00, 1.82it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 44/44 [00:20<00:00, 2.19it/s]
all 5609 8544 0.737 0.678 0.69 0.404
55/299 15.6G 0.04112 0.007414 0.001859 0.0504 9 640 0.8127 0.7854 0.8 0.5298 0.04826 0.00795 0.001707
56/299 15.6G 0.04016 0.00726 0.001358 0.04878 10 640 0.811 0.7887 0.7994 0.5291 0.04825 0.007945 0.001597
57/299 15.6G 0.04019 0.007257 0.00142 0.04887 5 640 0.8231 0.7785 0.8 0.5294 0.04811 0.007941 0.001571
58/299 15.6G 0.04006 0.007256 0.001411 0.04873 13 640 0.8282 0.7777 0.8003 0.5289 0.04838 0.00792 0.001526
59/299 15.6G 0.04022 0.007167 0.001235 0.04862 11 640 0.829 0.7783 0.801 0.5298 0.0484 0.007913 0.001491
60/299 15.6G 0.0399 0.007174 0.001278 0.04835 14 640 0.8273 0.7803 0.8013 0.5303 0.04839 0.007898 0.00147
61/299 15.6G 0.04038 0.007173 0.001428 0.04898 8 640 0.828 0.781 0.8013 0.5298 0.04841 0.007887 0.001482
62/299 15.6G 0.04052 0.00718 0.001279 0.04898 8 640 0.8251 0.7826 0.8024 0.5299 0.04843 0.007877 0.001487
63/299 15.6G 0.04029 0.007305 0.001732 0.04933 6 640 0.8203 0.7872 0.8033 0.5308 0.04854 0.007868 0.001478
64/299 15.6G 0.04078 0.007337 0.001571 0.04969 9 640 0.8297 0.7814 0.8042 0.5318 0.04883 0.007854 0.001453
```
2024/05/16
```
python train.py --workers 32 --device 0 --batch-size 96 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-tiny-custom.yaml --weights 'runs/train/yolov7-tiny-custom3/weights/best.pt' --name yolov7-tiny-custom --hyp data/hyp.scratch.custom.yaml
Model Summary: 263 layers, 6023106 parameters, 6023106 gradients
Scaled weight_decay = 0.00075
Optimizer groups: 58 .bias, 58 conv.weight, 61 other
train: Scanning '..\thesis_data\dataset\train\labels.cache' images and labels... 53317 found, 0 missing, 6883 empty, 1 corrupted: 100%|███████████████████████████████████████████| 53317/53317 [00:00<?, ?it/s]
val: Scanning '..\thesis_data\dataset\valid\labels.cache' images and labels... 5609 found, 0 missing, 287 empty, 0 corrupted: 100%|█████████████████████████████████████████████████| 5609/5609 [00:00<?, ?it/s]
autoanchor: Analyzing anchors... anchors/target = 3.57, Best Possible Recall (BPR) = 0.9992
Image sizes 640 train, 640 test
Using 32 dataloader workers
Logging results to runs\train\yolov7-tiny-custom4
Starting training for 100 epochs...
Epoch gpu_mem box obj cls total labels img_size
0/99 1.77G 0.06315 0.009217 0.01699 0.08936 142 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 556/556 [07:42<00:00, 1.20it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 0%| | 0/30 [00:00<?, ?it/s]C:\Users\rchiu\AppData\Roaming\Python\Python310\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:3484.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [00:27<00:00, 1.08it/s]
all 5609 8544 0.0708 0.135 0.0392 0.00762
Epoch gpu_mem box obj cls total labels img_size
1/99 15.3G 0.05764 0.00936 0.008088 0.07508 110 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 556/556 [07:26<00:00, 1.25it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [00:24<00:00, 1.23it/s]
all 5609 8544 0.41 0.277 0.218 0.0665
Epoch gpu_mem box obj cls total labels img_size
2/99 24.3G 0.05513 0.008781 0.006024 0.06994 117 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 556/556 [07:25<00:00, 1.25it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [00:23<00:00, 1.26it/s]
all 5609 8544 0.186 0.224 0.105 0.0334
Epoch gpu_mem box obj cls total labels img_size
3/99 24.3G 0.05405 0.008539 0.005115 0.06771 121 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 556/556 [07:24<00:00, 1.25it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [00:23<00:00, 1.28it/s]
all 5609 8544 0.364 0.415 0.322 0.142
Epoch gpu_mem box obj cls total labels img_size
4/99 24.3G 0.05164 0.00837 0.004354 0.06436 157 640: 100%|███████████████████████████████████████████████████████████████████████████████████████| 556/556 [07:36<00:00, 1.22it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|█████████████████████████████████████████████████████████████████████████████| 30/30 [00:23<00:00, 1.27it/s]
all 5609 8544 0.593 0.441 0.368 0.157
35/99 24.3G 0.04209 0.007404 0.001513 0.051 114 640 0.7703 0.723 0.7429 0.4661 0.05477 0.00808 0.002155
36/99 24.3G 0.04221 0.007495 0.001624 0.05133 123 640 0.7797 0.7162 0.7436 0.4676 0.05461 0.008086 0.002115
37/99 24.3G 0.04198 0.007433 0.001668 0.05108 130 640 0.7697 0.7238 0.7431 0.4677 0.05448 0.00809 0.002105
38/99 24.3G 0.04223 0.007416 0.001466 0.05112 115 640 0.7696 0.7241 0.7439 0.4688 0.05437 0.008098 0.002096
39/99 24.3G 0.04187 0.007412 0.001525 0.05081 126 640 0.7663 0.7274 0.7448 0.4693 0.05425 0.008101 0.002075
```
train command
```
python train.py --workers 128 --device 0 --batch-size 128 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-tiny-custom.yaml --weights 'runs/train/yolov7-tiny-custom4/w
eights/best.pt' --name yolov7-tiny-custom --hyp data/hyp.scratch.custom.yaml
```
# yolov7 training env config for UAV
以下無效
conda create --name yolov7 python=3.10
pip install -r requirment.txt
[install cuda](https://nvidia.github.io/cuda-python/install.html)
conda install -c nvidia cuda-python
以上無效
暫時將trainocr env clone 來用
```
(yolov7) C:\Users\richardchiu>python -V
Python 3.10.14
(yolov7) C:\Users\richardchiu>pip list
Package Version
----------------------- -----------
absl-py 2.1.0
addict 2.4.0
anyconfig 0.14.0
anyio 4.4.0
arabic-reshaper 2.1.3
asttokens 2.4.1
beautifulsoup4 4.12.3
Brotli 1.0.9
certifi 2024.2.2
charset-normalizer 2.0.4
click 8.1.7
colorama 0.4.6
comm 0.2.2
contourpy 1.2.1
cycler 0.12.1
debugpy 1.8.1
decorator 5.1.1
diffimg 0.2.3
docker-pycreds 0.4.0
easydict 1.13
exceptiongroup 1.2.0
executing 2.0.1
filelock 3.13.1
fonttools 4.53.0
future 1.0.0
getsize 1.1.11
gitdb 4.0.11
GitPython 3.1.43
gmpy2 2.1.2
grpcio 1.64.1
h11 0.14.0
httpcore 1.0.5
httpx 0.27.0
idna 3.7
imageio 2.34.1
imgaug 0.4.0
importlib_metadata 7.1.0
ipykernel 6.29.3
ipython 8.25.0
jedi 0.19.1
Jinja2 3.1.4
joblib 1.4.2
jupyter_client 8.6.2
jupyter_core 5.7.2
kiwisolver 1.4.5
lazy_loader 0.4
Markdown 3.6
MarkupSafe 2.1.3
matplotlib 3.9.0
matplotlib-inline 0.1.7
mkl-fft 1.3.1
mkl-random 1.2.2
mkl-service 2.4.0
mpmath 1.3.0
natsort 8.4.0
nest_asyncio 1.6.0
networkx 3.1
numpy 1.24.3
opencv-python 4.9.0.80
packaging 24.0
pandas 2.2.2
parso 0.8.4
pickleshare 0.7.5
Pillow 9.4.0
pip 24.0
platformdirs 4.2.2
polygon 1.2.0
prompt-toolkit 3.0.42
protobuf 4.25.3
psutil 5.9.8
pure-eval 0.2.2
pyclipper 1.3.0.post5
Pygments 2.18.0
pyparsing 3.1.2
pyperclip 1.8.2
PySocks 1.7.1
python-bidi 0.4.2
python-dateutil 2.9.0
pytz 2024.1
pywin32 306
PyYAML 6.0.1
pyzmq 26.0.3
requests 2.32.2
scikit-image 0.23.2
scikit-learn 1.5.0
scipy 1.13.1
seaborn 0.13.2
sentry-sdk 2.6.0
setproctitle 1.3.3
setuptools 69.5.1
shapely 2.0.4
six 1.16.0
smmap 5.0.1
sniffio 1.3.1
soupsieve 2.5
stack-data 0.6.2
sympy 1.12
tensorboard 2.17.0
tensorboard-data-server 0.7.2
tensorboardX 2.6.2.2
threadpoolctl 3.5.0
tifffile 2024.5.22
torch 2.2.0
torchaudio 2.2.0
torchvision 0.17.0
tornado 6.4
tqdm 4.66.4
traitlets 5.14.3
typing_extensions 4.11.0
tzdata 2024.1
urllib3 2.2.1
wandb 0.17.3
wcwidth 0.2.13
websocket-client 1.8.0
websockets 12.0
Werkzeug 3.0.3
wheel 0.43.0
wikipedia 1.4.0
win-inet-pton 1.1.0
zipp 3.17.0
```
conda list
```
(yolov7) C:\Users\richardchiu>conda list
# packages in environment at C:\Users\richardchiu\.conda\envs\yolov7:
#
# Name Version Build Channel
absl-py 2.1.0 pypi_0 pypi
addict 2.4.0 pypi_0 pypi
anyconfig 0.14.0 pypi_0 pypi
anyio 4.4.0 pypi_0 pypi
arabic-reshaper 2.1.3 pypi_0 pypi
asttokens 2.4.1 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.12.3 pypi_0 pypi
blas 1.0 mkl
brotli-python 1.0.9 py310hd77b12b_8
bzip2 1.0.8 h2bbff1b_6
ca-certificates 2024.6.2 h56e8100_0 conda-forge
certifi 2024.2.2 pyhd8ed1ab_0 conda-forge
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.1.7 pypi_0 pypi
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
comm 0.2.2 pyhd8ed1ab_0 conda-forge
contourpy 1.2.1 pypi_0 pypi
cuda-cccl 12.5.39 0 nvidia
cuda-cccl_win-64 12.5.39 0 nvidia
cuda-cudart 12.1.105 0 nvidia
cuda-cudart-dev 12.1.105 0 nvidia
cuda-cupti 12.1.105 0 nvidia
cuda-libraries 12.1.0 0 nvidia
cuda-libraries-dev 12.1.0 0 nvidia
cuda-nvrtc 12.1.105 0 nvidia
cuda-nvrtc-dev 12.1.105 0 nvidia
cuda-nvtx 12.1.105 0 nvidia
cuda-opencl 12.5.39 0 nvidia
cuda-opencl-dev 12.5.39 0 nvidia
cuda-profiler-api 12.5.39 0 nvidia
cuda-runtime 12.1.0 0 nvidia
cuda-version 12.5 3 nvidia
cudnn 8.9.2.26 cuda12_0
cycler 0.12.1 pypi_0 pypi
debugpy 1.8.1 py310h00ffb61_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
diffimg 0.2.3 pypi_0 pypi
docker-pycreds 0.4.0 pypi_0 pypi
easydict 1.13 pypi_0 pypi
exceptiongroup 1.2.0 pyhd8ed1ab_2 conda-forge
executing 2.0.1 pyhd8ed1ab_0 conda-forge
filelock 3.13.1 py310haa95532_0
fonttools 4.53.0 pypi_0 pypi
freetype 2.12.1 ha860e81_0
future 1.0.0 pypi_0 pypi
getsize 1.1.11 pypi_0 pypi
gitdb 4.0.11 pypi_0 pypi
gitpython 3.1.43 pypi_0 pypi
gmpy2 2.1.2 py310h7f96b67_0
grpcio 1.64.1 pypi_0 pypi
h11 0.14.0 pypi_0 pypi
httpcore 1.0.5 pypi_0 pypi
httpx 0.27.0 pypi_0 pypi
idna 3.7 py310haa95532_0
imageio 2.34.1 pypi_0 pypi
imgaug 0.4.0 pypi_0 pypi
importlib-metadata 7.1.0 pyha770c72_0 conda-forge
importlib_metadata 7.1.0 hd8ed1ab_0 conda-forge
intel-openmp 2021.4.0 haa95532_3556
ipykernel 6.29.3 pyha63f2e9_0 conda-forge
ipython 8.25.0 pyh7428d3b_0 conda-forge
jedi 0.19.1 pyhd8ed1ab_0 conda-forge
jinja2 3.1.4 py310haa95532_0
joblib 1.4.2 pypi_0 pypi
jpeg 9e h2bbff1b_1
jupyter_client 8.6.2 pyhd8ed1ab_0 conda-forge
jupyter_core 5.7.2 py310h5588dad_0 conda-forge
kiwisolver 1.4.5 pypi_0 pypi
krb5 1.21.2 heb0366b_0 conda-forge
lazy-loader 0.4 pypi_0 pypi
lcms2 2.12 h83e58a3_0
lerc 3.0 hd77b12b_0
libcublas 12.1.0.26 0 nvidia
libcublas-dev 12.1.0.26 0 nvidia
libcufft 11.0.2.4 0 nvidia
libcufft-dev 11.0.2.4 0 nvidia
libcurand 10.3.6.39 0 nvidia
libcurand-dev 10.3.6.39 0 nvidia
libcusolver 11.4.4.55 0 nvidia
libcusolver-dev 11.4.4.55 0 nvidia
libcusparse 12.0.2.55 0 nvidia
libcusparse-dev 12.0.2.55 0 nvidia
libdeflate 1.17 h2bbff1b_1
libffi 3.4.4 hd77b12b_1
libjpeg-turbo 2.0.0 h196d8e1_0
libnpp 12.0.2.50 0 nvidia
libnpp-dev 12.0.2.50 0 nvidia
libnvfatbin 12.5.39 0 nvidia
libnvfatbin-dev 12.5.39 0 nvidia
libnvjitlink 12.1.105 0 nvidia
libnvjitlink-dev 12.1.105 0 nvidia
libnvjpeg 12.1.1.14 0 nvidia
libnvjpeg-dev 12.1.1.14 0 nvidia
libpng 1.6.39 h8cc25b3_0
libsodium 1.0.18 h8d14728_1 conda-forge
libtiff 4.5.1 hd77b12b_0
libuv 1.44.2 h2bbff1b_0
libwebp-base 1.3.2 h2bbff1b_0
lz4-c 1.9.4 h2bbff1b_1
markdown 3.6 pypi_0 pypi
markupsafe 2.1.3 py310h2bbff1b_0
matplotlib 3.9.0 pypi_0 pypi
matplotlib-inline 0.1.7 pyhd8ed1ab_0 conda-forge
mkl 2021.4.0 haa95532_640
mkl-service 2.4.0 py310h2bbff1b_0
mkl_fft 1.3.1 py310ha0764ea_0
mkl_random 1.2.2 py310h4ed8f06_0
mpc 1.1.0 h7edee0f_1
mpfr 4.0.2 h62dcd97_1
mpir 3.0.0 hec2e145_1
mpmath 1.3.0 py310haa95532_0
natsort 8.4.0 pypi_0 pypi
nest-asyncio 1.6.0 pyhd8ed1ab_0 conda-forge
networkx 3.1 py310haa95532_0
numpy 1.24.3 py310hdc03b94_0
numpy-base 1.24.3 py310h3caf3d7_0
opencv-python 4.9.0.80 pypi_0 pypi
openjpeg 2.4.0 h4fc8c34_0
openssl 3.3.0 h2466b09_3 conda-forge
packaging 24.0 pyhd8ed1ab_0 conda-forge
pandas 2.2.2 pypi_0 pypi
parso 0.8.4 pyhd8ed1ab_0 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 9.4.0 pypi_0 pypi
pip 24.0 py310haa95532_0
platformdirs 4.2.2 pyhd8ed1ab_0 conda-forge
polygon 1.2.0 pypi_0 pypi
prompt-toolkit 3.0.42 pyha770c72_0 conda-forge
protobuf 4.25.3 pypi_0 pypi
psutil 5.9.8 py310h8d17308_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pyclipper 1.3.0.post5 pypi_0 pypi
pygments 2.18.0 pyhd8ed1ab_0 conda-forge
pyparsing 3.1.2 pypi_0 pypi
pyperclip 1.8.2 pypi_0 pypi
pysocks 1.7.1 py310haa95532_0
python 3.10.14 he1021f5_1
python-bidi 0.4.2 pypi_0 pypi
python-dateutil 2.9.0 pyhd8ed1ab_0 conda-forge
python_abi 3.10 2_cp310 conda-forge
pytorch 2.2.0 py3.10_cuda12.1_cudnn8_0 pytorch
pytorch-cuda 12.1 hde6ce7c_5 pytorch
pytorch-mutex 1.0 cuda pytorch
pytz 2024.1 pypi_0 pypi
pywin32 306 py310h00ffb61_2 conda-forge
pyyaml 6.0.1 py310h2bbff1b_0
pyzmq 26.0.3 py310h656833d_0 conda-forge
requests 2.32.2 py310haa95532_0
scikit-image 0.23.2 pypi_0 pypi
scikit-learn 1.5.0 pypi_0 pypi
scipy 1.13.1 pypi_0 pypi
seaborn 0.13.2 pypi_0 pypi
sentry-sdk 2.6.0 pypi_0 pypi
setproctitle 1.3.3 pypi_0 pypi
setuptools 69.5.1 py310haa95532_0
shapely 2.0.4 pypi_0 pypi
six 1.16.0 pyhd3eb1b0_1
smmap 5.0.1 pypi_0 pypi
sniffio 1.3.1 pypi_0 pypi
soupsieve 2.5 pypi_0 pypi
sqlite 3.45.3 h2bbff1b_0
stack_data 0.6.2 pyhd8ed1ab_0 conda-forge
sympy 1.12 py310haa95532_0
tensorboard 2.17.0 pypi_0 pypi
tensorboard-data-server 0.7.2 pypi_0 pypi
tensorboardx 2.6.2.2 pypi_0 pypi
threadpoolctl 3.5.0 pypi_0 pypi
tifffile 2024.5.22 pypi_0 pypi
tk 8.6.14 h0416ee5_0
torchaudio 2.2.0 pypi_0 pypi
torchvision 0.17.0 pypi_0 pypi
tornado 6.4 py310h8d17308_0 conda-forge
tqdm 4.66.4 pypi_0 pypi
traitlets 5.14.3 pyhd8ed1ab_0 conda-forge
typing_extensions 4.11.0 py310haa95532_0
tzdata 2024.1 pypi_0 pypi
ucrt 10.0.22621.0 h57928b3_0 conda-forge
urllib3 2.2.1 py310haa95532_0
vc 14.2 h2eaa2aa_1
vc14_runtime 14.38.33135 h835141b_20 conda-forge
vs2015_runtime 14.38.33135 h22015db_20 conda-forge
wandb 0.17.3 pypi_0 pypi
wcwidth 0.2.13 pyhd8ed1ab_0 conda-forge
websocket-client 1.8.0 pypi_0 pypi
websockets 12.0 pypi_0 pypi
werkzeug 3.0.3 pypi_0 pypi
wheel 0.43.0 py310haa95532_0
wikipedia 1.4.0 pypi_0 pypi
win_inet_pton 1.1.0 py310haa95532_0
xz 5.4.6 h8cc25b3_1
yaml 0.2.5 he774522_0
zeromq 4.3.5 he1f189c_4 conda-forge
zipp 3.17.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.13 h8cc25b3_1
zstd 1.5.5 hd43e919_2
```
config files
```
調整其中的內容使其可以正確運行
data\hyp.scratch.custom.yaml <-- hyper parameter
data/custom.yaml : <-- 改變資料位置
train: ../thesis_data/dataset/train/images
val: ../thesis_data/dataset/valid/images
nc: 4
names: ['military aircraft','military ship','military tank','civilianvehicle']
cfg/training/yolov7-uav.yaml <-- nc:
nc:4
```
command
```
# 2024-06-27 C:\develop\yolov7_UAV\run_train_uav.bat
call C:\anaconda3\Scripts\activate.bat C:\anaconda3
call conda activate yolov7
cd C:\develop\yolov7_UAV
python train.py --workers 8 --device 0 --batch-size 32 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-UAV.yaml --resume C:\develop\yolov7_UAV\runs\train\yolov7-uav7\weights\best.pt --name yolov7-uav --hyp data/hyp.scratch.custom.yaml
REM python train.py --workers 8 --device 1,0 --batch-size 60 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-UAV.yaml --weights C:\develop\yolov7_UAV\runs\train\yolov7-uav7\weights\best.pt --name yolov7-uav --hyp data/hyp.scratch.custom.yaml
```