Skip to content

Commit c51b8cd

Browse files
author
Joachim
committed
chore: Added some descriptions
1 parent 07dd231 commit c51b8cd

File tree

5 files changed

+74
-7
lines changed

5 files changed

+74
-7
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Package to train object detection model for biological problems
3232
## Start the training
3333

3434
1) Go to `projects/<PROJECT NAME>/data.yaml` and enter the labels of your training data.
35-
2) Execute `start-training.sh`
35+
2) Execute `start-training.sh`or `start-seg-training.sh`
3636

3737

3838
# Faster training with GPU
@@ -53,7 +53,7 @@ sudo systemctl restart docker
5353
```
5454

5555
- When starting the docker container add `--gpus=all` argument
56-
- Add the argument `--device 0` to the `start-training.sh`
56+
- Add the argument `--device 0` to the `start-training.sh` and `start-seg-training.sh`
5757

5858
Use `nvtop` to show gpu usage
5959

@@ -68,3 +68,29 @@ https://blog.paperspace.com/train-yolov5-custom-data/
6868
https://github.com/ultralytics/yolov5/issues/475
6969

7070

71+
72+
73+
## Metrics
74+
75+
76+
Klassenbezogene Metriken
77+
Einer der Abschnitte der Ausgabe ist die klassenweise Aufschlüsselung der Leistungsmetriken. Diese detaillierten Informationen sind nützlich, wenn du herausfinden willst, wie gut das Modell für jede einzelne Klasse abschneidet, vor allem in Datensätzen mit einer Vielzahl von Objektkategorien. Für jede Klasse im Datensatz wird Folgendes angegeben:
78+
79+
Klasse: Dies bezeichnet den Namen der Objektklasse, z. B. "Person", "Auto" oder "Hund".
80+
81+
Bilder: Diese Metrik zeigt dir die Anzahl der Bilder im Validierungsset, die die Objektklasse enthalten.
82+
83+
Instanzen: Hier wird gezählt, wie oft die Klasse in allen Bildern des Validierungssatzes vorkommt.
84+
85+
Box(P, R, mAP50, mAP50-95): Diese Metrik gibt Aufschluss über die Leistung des Modells bei der Erkennung von Objekten:
86+
87+
P (Präzision): Die Genauigkeit der erkannten Objekte, die angibt, wie viele Erkennungen richtig waren.
88+
89+
R (Recall): Die Fähigkeit des Modells, alle Instanzen von Objekten in den Bildern zu identifizieren.
90+
91+
mAP50: Mittlere durchschnittliche Genauigkeit, berechnet bei einem Schwellenwert von 0,50 für die Überschneidung über die Vereinigung (IoU). Er ist ein Maß für die Genauigkeit des Modells, das nur die "einfachen" Erkennungen berücksichtigt.
92+
93+
mAP50-95: Der Durchschnitt der durchschnittlichen Genauigkeit, die bei verschiedenen IoU-Schwellenwerten zwischen 0,50 und 0,95 berechnet wurde. Er gibt einen umfassenden Überblick über die Leistung des Modells bei verschiedenen Schwierigkeitsgraden.
94+
95+
96+
https://docs.ultralytics.com/de/guides/yolo-performance-metrics/#how-to-calculate-metrics-for-yolov8-model

convert_pb_to_onnx.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
3+
#python -m tf2onnx.convert --input `pwd`/projects/bio_zoo/nucleus/saved_model.pb --output bio_zoo_nucleus.onnx --opset 12
4+
5+
#saved_model_cli show --dir `pwd`/projects/bio_zoo/nucleus/TF_SavedModel/ --all
6+
# Look for signature_def inputs/outputs
7+
# --inputs X:0[1,28,28,3]
8+
9+
python -m tf2onnx.convert --saved-model ./TF_SavedModel --opset 12 --output model.onnx --inputs input:0
10+
#python -m onnxruntime.tools.make_dynamic_shape_fixed -h 640
11+
12+
# OpenCV just supports fixed shape models
13+
# https://onnxruntime.ai/docs/tutorials/mobile/helpers/make-dynamic-shape-fixed.html
14+
15+
16+
17+
18+
python -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param batch --dim_value 3 model.onnx model.fixed.onnx
19+
20+
21+
#python -m onnxruntime.tools.make_dynamic_shape_fixed --input_name input --input_shape 1,3,640,640 model.onnx model.fixed.onnx
22+
23+
24+
25+
26+
python -m onnxruntime.tools.make_dynamic_shape_fixed --input_name input:0 --input_shape 1,3,640,640 model.onnx model.fixed.onnx

docker/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ RUN pip install --upgrade pip
1818
RUN ln -s /usr/bin/python3 /usr/bin/python
1919
RUN git clone -b v1.0.0-alpha01 https://github.com/joda01/yolov5.git &&\
2020
cd yolov5/ &&\
21-
pip install -r requirements.txt
21+
pip install -r requirements.txt
22+
23+
#RUN pip install tensorflow
24+
#RUN pip install tf2onnx
25+
#RUN pip install onnxruntime
26+

start-seg-training.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ cd /workspaces/open-bio-image-trainer
2121

2222
#python /yolov5/segment/train.py --model yolov5m-seg.pt --data coco128-seg.yaml --epochs 5 --img 640
2323

24-
python /yolov5/segment/train.py --img 640 --batch 1 --epochs 256 --data `pwd`/projects/$projectname/data.yaml --weights yolov5m-seg.pt --cfg yolov5m-seg.yaml --device cpu --workers 1 --project `pwd`/projects/$projectname --name result --device 0
24+
python /yolov5/segment/train.py --img 640 --batch 1 --epochs 256 --data `pwd`/projects/$projectname/data.yaml --weights yolov5m-seg.pt --cfg yolov5m-seg.yaml --device 0 --workers 1 --project `pwd`/projects/$projectname --name result
2525

2626
#
2727
# Convert to ONNX
2828
#
29-
#python /yolov5/export.py --weights `pwd`/projects/nucleus02/result2/weights/best.pt --include torchscript onnx --opset 12
29+
#python /yolov5/export.py --weights `pwd`/projects/nucleus02/result2/weights/best.pt --include torchscript onnx --opset 12
30+
31+
#python /yolov5/export.py --weights `pwd`/projects/cell_detection/result5/weights/best.pt --include torchscript onnx --opset 12
32+
33+
34+
#python /yolov5/export.py --weights `pwd`/projects/cell-brightfield-01/result3/weights/best.pt --include torchscript onnx --opset 12
35+
36+
#python /yolov5/export.py --weights `pwd`/projects/cell-brightfield-02/result4/weights/best.pt --include torchscript onnx --opset 12
37+
#python /yolov5/export.py --weights `pwd`/projects/cell-brightfield-02/result5/weights/best.pt --include torchscript onnx --opset 12

start-training.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ cd /yolov5
1818
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
1919
cd /workspaces/open-bio-image-trainer
2020

21-
python /yolov5/train.py --img 640 --batch 16 --epochs 256 --data `pwd`/projects/$projectname/data.yaml --weights yolov5m.pt --cfg yolov5m.yaml --device cpu --workers 1 --project `pwd`/projects/$projectname --name result --device 0
21+
python /yolov5/train.py --img 640 --batch 8 --epochs 256 --data `pwd`/projects/$projectname/data.yaml --weights yolov5m.pt --cfg yolov5m.yaml --device cpu --workers 1 --project `pwd`/projects/$projectname --name result --device 0
2222

2323

2424

2525
#
2626
# Convert to ONNX
2727
#
28-
#python /yolov5/export.py --weights `pwd`/projects/nucleus02/result2/weights/best.pt --include torchscript onnx --opset 12
28+
#python /yolov5/export.py --weights `pwd`/projects/nucleus02/result2/weights/best.pt --include torchscript onnx --opset 12
29+
30+
#python /yolov5/export.py --weights `pwd`/projects/cell-brightfield-02/result3/weights/best.pt --include torchscript onnx --opset 12

0 commit comments

Comments
 (0)