Skip to content

Commit

Permalink
Merge pull request #80 from NUTFes/feat/nose/72-bring-number-class
Browse files Browse the repository at this point in the history
学習結果を追加
  • Loading branch information
nose221834 authored Sep 8, 2024
2 parents 51a1fdf + d9d8699 commit b31c4b6
Show file tree
Hide file tree
Showing 109 changed files with 516 additions and 28 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
*.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/train14/weights/last.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/train14/weights/best.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_640_FHD/weights/last.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_640_FHD/weights/best.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_FHD_rect/weights/last.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_FHD_rect/weights/best.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/l_640_FHD/weights/last.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/l_640_FHD/weights/best.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_640_FHD_color_BackOne/weights/last.pt filter=lfs diff=lfs merge=lfs -text
yolo_fine_tuning/runs/detect/m_640_FHD_color_BackOne/weights/best.pt filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__/
/sahi
.env
raspi/result/prediction_visual.png
*.pt
21 changes: 14 additions & 7 deletions raspi/number/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
load_dotenv()

# パスの設定
HOME_DIR = os.environ["HOME"]
PATH = HOME_DIR + "/yolo_fine_tuning/runs/detect/train14/weights/best.pt"
HOME_DIR = os.environ["HOME_DIR"]
PATH = HOME_DIR + "/yolo_fine_tuning/runs/detect/l_640_FHD/weights/best.pt"

# YOLOモデルのロード
model = YOLO(PATH)
model = YOLO(PATH, verbose=False)

# カメラデバイスを開く
cap = cv2.VideoCapture(0)
Expand All @@ -25,27 +25,34 @@
while cap.isOpened():
# リアルタイム画像からフレームを読み込む
ret, frame = cap.read()


# フレームが確認できる:true
if ret:
# フレームごとに物体検知を行う
results = model.track(frame)
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray_frame_rgb = cv2.cvtColor(gray_frame, cv2.COLOR_GRAY2RGB)

results = model.track(gray_frame_rgb, device='cuda')
# results = model.track(frame, imgsz=(1920, 1080), device='cuda')


# 検知結果を描画
annotated_frame = results[0].plot()

# show
cv2.imshow("Frame",annotated_frame)

# 出力動画にフレームを書き込む
out.write(annotated_frame)

# フレームを表示
cv2.imshow("Frame", annotated_frame)

# 'q'キーが押されたら終了
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break


# リソースの解放
cap.release()
out.release()
Expand Down
17 changes: 17 additions & 0 deletions raspi/number/model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- m_640_FHD
- グレースケールにしたFHDの画像を学習させたもの
- 今のところ一番使い勝手が良い
- 背景画像が複数種類
- m_FHD_rect
- グレースケールにし、画像サイズが普遍になるように設定し学習させたもの
- 微妙な精度
- 背景を統一
- l_640_FHD
- model8l.ptに追加学習したもの
- オプション内容はm_640_FHDと同じ
- 重くて使いづらい
- 白以外のナンバーの精度がとても悪い
- 背景を統一



Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions yolo_fine_tuning/runs/detect/l_640_FHD/results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
epoch, train/box_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), val/box_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
1, 0.67685, 0.3953, 0.8331, 0.98654, 0.88973, 0.93778, 0.74885, 0.63685, 0.33004, 0.79577, 0.00066644, 0.00066644, 0.00066644
2, 0.50683, 0.29285, 0.80155, 0.99366, 0.89526, 0.94802, 0.78474, 0.52749, 0.28119, 0.78093, 0.0010692, 0.0010692, 0.0010692
3, 0.42866, 0.25384, 0.79112, 0.99529, 0.91066, 0.95817, 0.82919, 0.40829, 0.23185, 0.77232, 0.0012079, 0.0012079, 0.0012079
4, 0.3716, 0.22142, 0.78428, 0.98165, 0.92475, 0.96069, 0.8543, 0.36759, 0.20497, 0.76868, 0.000812, 0.000812, 0.000812
5, 0.32738, 0.19429, 0.77937, 0.9889, 0.92465, 0.96251, 0.86915, 0.34049, 0.19252, 0.76625, 0.000416, 0.000416, 0.000416
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions yolo_fine_tuning/runs/detect/l_640_FHD/weights/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.pt
3 changes: 3 additions & 0 deletions yolo_fine_tuning/runs/detect/l_640_FHD/weights/best.pt
Git LFS file not shown
3 changes: 3 additions & 0 deletions yolo_fine_tuning/runs/detect/l_640_FHD/weights/last.pt
Git LFS file not shown
6 changes: 6 additions & 0 deletions yolo_fine_tuning/runs/detect/m_640_FHD/results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
epoch, train/box_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), val/box_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
1, 0.70887, 0.41523, 0.83844, 0.98408, 0.87413, 0.93341, 0.74358, 0.6663, 0.34132, 0.80185, 0.00066644, 0.00066644, 0.00066644
2, 0.53583, 0.30824, 0.80444, 0.98859, 0.90243, 0.95113, 0.80468, 0.49235, 0.27633, 0.78274, 0.0010692, 0.0010692, 0.0010692
3, 0.45435, 0.26698, 0.79379, 0.98149, 0.91482, 0.9538, 0.83099, 0.42844, 0.25081, 0.77453, 0.0012079, 0.0012079, 0.0012079
4, 0.39643, 0.23437, 0.78659, 0.99131, 0.91356, 0.9576, 0.83999, 0.43174, 0.23201, 0.77332, 0.000812, 0.000812, 0.000812
5, 0.3511, 0.20764, 0.7817, 0.99418, 0.91299, 0.95326, 0.84083, 0.4017, 0.21327, 0.77038, 0.000416, 0.000416, 0.000416
1 change: 1 addition & 0 deletions yolo_fine_tuning/runs/detect/m_640_FHD/weights/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.pt
3 changes: 3 additions & 0 deletions yolo_fine_tuning/runs/detect/m_640_FHD/weights/best.pt
Git LFS file not shown
3 changes: 3 additions & 0 deletions yolo_fine_tuning/runs/detect/m_640_FHD/weights/last.pt
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
epoch, train/box_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), val/box_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
1, 0.58449, 0.34396, 0.81602, 0.98443, 0.93586, 0.97909, 0.81684, 0.55458, 0.29184, 0.78206, 0.00066644, 0.00066644, 0.00066644
2, 0.42472, 0.24457, 0.78931, 0.9742, 0.95333, 0.98473, 0.86903, 0.44232, 0.25442, 0.77217, 0.0010692, 0.0010692, 0.0010692
3, 0.36312, 0.21305, 0.78243, 0.98055, 0.93847, 0.98212, 0.90056, 0.34956, 0.21314, 0.76746, 0.0012079, 0.0012079, 0.0012079
4, 0.32035, 0.18845, 0.77774, 0.98702, 0.94725, 0.98425, 0.89835, 0.36013, 0.20169, 0.76503, 0.000812, 0.000812, 0.000812
5, 0.27901, 0.16451, 0.77428, 0.98724, 0.9509, 0.98448, 0.92356, 0.28607, 0.16842, 0.76276, 0.000416, 0.000416, 0.000416
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.pt
Git LFS file not shown
Git LFS file not shown
6 changes: 6 additions & 0 deletions yolo_fine_tuning/runs/detect/m_FHD_rect/results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
epoch, train/box_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), val/box_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
1, 0.57716, 0.37898, 0.89307, 0.99394, 0.98269, 0.99459, 0.84107, 0.6096, 0.33031, 0.82871, 0.00066644, 0.00066644, 0.00066644
2, 0.43363, 0.2752, 0.83879, 0.99862, 0.99048, 0.99499, 0.91155, 0.40265, 0.25293, 0.78532, 0.0010692, 0.0010692, 0.0010692
3, 0.364, 0.23379, 0.81604, 0.99875, 0.99116, 0.99499, 0.93123, 0.34977, 0.22145, 0.77599, 0.0012079, 0.0012079, 0.0012079
4, 0.31465, 0.20109, 0.80336, 0.99934, 0.99488, 0.99499, 0.95489, 0.2688, 0.19069, 0.76717, 0.000812, 0.000812, 0.000812
5, 0.26596, 0.16881, 0.79202, 0.99945, 0.99668, 0.995, 0.97108, 0.22011, 0.15982, 0.75971, 0.000416, 0.000416, 0.000416
1 change: 1 addition & 0 deletions yolo_fine_tuning/runs/detect/m_FHD_rect/weights/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.pt
2 changes: 1 addition & 1 deletion yolo_fine_tuning/src/convert_ground_truth_to_yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 定義
inputPath = HOME_DIR + "/yolo_fine_tuning/resorces/dataset/output_ground_truth"
# outputPath = "./dataset/yolo"
outputPath = "./yolo"
outputPath = HOME_DIR + "/yolo_fine_tuning/yolo"
manifest = "output.manifest"
# 学習用と検証用の分割比率
ratio = 0.8 # 8対2に分割する
Expand Down
Loading

0 comments on commit b31c4b6

Please sign in to comment.