Babu commited on
Commit
204d39e
1 Parent(s): 9a048be

initial commit

Browse files
Files changed (48) hide show
  1. .env +1 -0
  2. .gitignore +2 -0
  3. app.py +15 -0
  4. data/frame_422.jpg +0 -0
  5. requirements.txt +0 -0
  6. runs/segment/train/BoxF1_curve.png +0 -0
  7. runs/segment/train/BoxPR_curve.png +0 -0
  8. runs/segment/train/BoxP_curve.png +0 -0
  9. runs/segment/train/BoxR_curve.png +0 -0
  10. runs/segment/train/MaskF1_curve.png +0 -0
  11. runs/segment/train/MaskPR_curve.png +0 -0
  12. runs/segment/train/MaskP_curve.png +0 -0
  13. runs/segment/train/MaskR_curve.png +0 -0
  14. runs/segment/train/args.yaml +106 -0
  15. runs/segment/train/confusion_matrix.png +0 -0
  16. runs/segment/train/confusion_matrix_normalized.png +0 -0
  17. runs/segment/train/events.out.tfevents.1717071496.d5f1cd638bb0.15173.0 +3 -0
  18. runs/segment/train/labels.jpg +0 -0
  19. runs/segment/train/labels_correlogram.jpg +0 -0
  20. runs/segment/train/results.csv +101 -0
  21. runs/segment/train/results.png +0 -0
  22. runs/segment/train/train_batch0.jpg +0 -0
  23. runs/segment/train/train_batch1.jpg +0 -0
  24. runs/segment/train/train_batch2.jpg +0 -0
  25. runs/segment/train/train_batch90.jpg +0 -0
  26. runs/segment/train/train_batch91.jpg +0 -0
  27. runs/segment/train/train_batch92.jpg +0 -0
  28. runs/segment/train/val_batch0_labels.jpg +0 -0
  29. runs/segment/train/val_batch0_pred.jpg +0 -0
  30. runs/segment/train/weights/best.pt +3 -0
  31. runs/segment/train/weights/best.zip +3 -0
  32. runs/segment/train/weights/last.pt +3 -0
  33. runs/segment/val/BoxF1_curve.png +0 -0
  34. runs/segment/val/BoxPR_curve.png +0 -0
  35. runs/segment/val/BoxP_curve.png +0 -0
  36. runs/segment/val/BoxR_curve.png +0 -0
  37. runs/segment/val/MaskF1_curve.png +0 -0
  38. runs/segment/val/MaskPR_curve.png +0 -0
  39. runs/segment/val/MaskP_curve.png +0 -0
  40. runs/segment/val/MaskR_curve.png +0 -0
  41. runs/segment/val/confusion_matrix.png +0 -0
  42. runs/segment/val/confusion_matrix_normalized.png +0 -0
  43. runs/segment/val/val_batch0_labels.jpg +0 -0
  44. runs/segment/val/val_batch0_pred.jpg +0 -0
  45. src/controllers/__pycache__/sack_detector.cpython-310.pyc +0 -0
  46. src/controllers/sack_detector.py +27 -0
  47. src/handlers/__pycache__/image_processing.cpython-310.pyc +0 -0
  48. src/handlers/image_processing.py +48 -0
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ YOLO_MODEL_PATH = "runs/segment/train/weights/last.pt"
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .conda/*
2
+ .conda
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import streamlit as st
4
+
5
+ from src.controllers.sack_detector import SackDetector
6
+
7
+ uploaded_file = st.file_uploader("Choose a image file", type="jpg")
8
+
9
+ if uploaded_file is not None:
10
+ # Convert the file to an opencv image.
11
+ file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
12
+ opencv_image = cv2.imdecode(file_bytes, 1)
13
+ detected_image, result = SackDetector().detect_objects(image_path=opencv_image)
14
+ # Now do something with the image! For example, let's display it:
15
+ st.image(detected_image, channels="BGR")
data/frame_422.jpg ADDED
requirements.txt ADDED
Binary file (2.42 kB). View file
 
runs/segment/train/BoxF1_curve.png ADDED
runs/segment/train/BoxPR_curve.png ADDED
runs/segment/train/BoxP_curve.png ADDED
runs/segment/train/BoxR_curve.png ADDED
runs/segment/train/MaskF1_curve.png ADDED
runs/segment/train/MaskPR_curve.png ADDED
runs/segment/train/MaskP_curve.png ADDED
runs/segment/train/MaskR_curve.png ADDED
runs/segment/train/args.yaml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task: segment
2
+ mode: train
3
+ model: yolov8n-seg.yaml
4
+ data: /content/Surf_bag_segmentation-1/data.yaml
5
+ epochs: 100
6
+ time: null
7
+ patience: 100
8
+ batch: 16
9
+ imgsz: 640
10
+ save: true
11
+ save_period: -1
12
+ cache: false
13
+ device: null
14
+ workers: 8
15
+ project: null
16
+ name: train
17
+ exist_ok: false
18
+ pretrained: yolov8n-seg.pt
19
+ optimizer: auto
20
+ verbose: true
21
+ seed: 0
22
+ deterministic: true
23
+ single_cls: false
24
+ rect: false
25
+ cos_lr: false
26
+ close_mosaic: 10
27
+ resume: false
28
+ amp: true
29
+ fraction: 1.0
30
+ profile: false
31
+ freeze: null
32
+ multi_scale: false
33
+ overlap_mask: true
34
+ mask_ratio: 4
35
+ dropout: 0.0
36
+ val: true
37
+ split: val
38
+ save_json: false
39
+ save_hybrid: false
40
+ conf: null
41
+ iou: 0.7
42
+ max_det: 300
43
+ half: false
44
+ dnn: false
45
+ plots: true
46
+ source: null
47
+ vid_stride: 1
48
+ stream_buffer: false
49
+ visualize: false
50
+ augment: false
51
+ agnostic_nms: false
52
+ classes: null
53
+ retina_masks: false
54
+ embed: null
55
+ show: false
56
+ save_frames: false
57
+ save_txt: false
58
+ save_conf: false
59
+ save_crop: false
60
+ show_labels: true
61
+ show_conf: true
62
+ show_boxes: true
63
+ line_width: null
64
+ format: torchscript
65
+ keras: false
66
+ optimize: false
67
+ int8: false
68
+ dynamic: false
69
+ simplify: false
70
+ opset: null
71
+ workspace: 4
72
+ nms: false
73
+ lr0: 0.01
74
+ lrf: 0.01
75
+ momentum: 0.937
76
+ weight_decay: 0.0005
77
+ warmup_epochs: 3.0
78
+ warmup_momentum: 0.8
79
+ warmup_bias_lr: 0.1
80
+ box: 7.5
81
+ cls: 0.5
82
+ dfl: 1.5
83
+ pose: 12.0
84
+ kobj: 1.0
85
+ label_smoothing: 0.0
86
+ nbs: 64
87
+ hsv_h: 0.015
88
+ hsv_s: 0.7
89
+ hsv_v: 0.4
90
+ degrees: 0.0
91
+ translate: 0.1
92
+ scale: 0.5
93
+ shear: 0.0
94
+ perspective: 0.0
95
+ flipud: 0.0
96
+ fliplr: 0.5
97
+ bgr: 0.0
98
+ mosaic: 1.0
99
+ mixup: 0.0
100
+ copy_paste: 0.0
101
+ auto_augment: randaugment
102
+ erasing: 0.4
103
+ crop_fraction: 1.0
104
+ cfg: null
105
+ tracker: botsort.yaml
106
+ save_dir: runs/segment/train
runs/segment/train/confusion_matrix.png ADDED
runs/segment/train/confusion_matrix_normalized.png ADDED
runs/segment/train/events.out.tfevents.1717071496.d5f1cd638bb0.15173.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5565a2348302f0a12a73fa61fb5d589995e0accc2071a04e5a33afc7fd4fd5a6
3
+ size 332723
runs/segment/train/labels.jpg ADDED
runs/segment/train/labels_correlogram.jpg ADDED
runs/segment/train/results.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch, train/box_loss, train/seg_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), metrics/precision(M), metrics/recall(M), metrics/mAP50(M), metrics/mAP50-95(M), val/box_loss, val/seg_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
2
+ 1, 1.25, 4.7884, 2.997, 1.6106, 0.00333, 1, 0.4975, 0.21554, 0.00333, 1, 0.4975, 0.14925, 1.6977, 4.2264, 3.9952, 1.8524, 0, 0, 0
3
+ 2, 1.302, 4.1011, 3.0784, 1.5848, 0.00333, 1, 0.4975, 0.21554, 0.00333, 1, 0.4975, 0.14925, 1.6791, 4.2483, 4.066, 1.842, 1.9802e-05, 1.9802e-05, 1.9802e-05
4
+ 3, 1.9791, 4.3966, 3.4002, 1.7095, 0.00333, 1, 0.4975, 0.22379, 0.00333, 1, 0.4975, 0.14925, 1.631, 4.3783, 4.1157, 1.799, 3.9208e-05, 3.9208e-05, 3.9208e-05
5
+ 4, 1.1262, 3.9255, 2.729, 1.2698, 0.00333, 1, 0.66333, 0.29013, 0.00333, 1, 0.66333, 0.20112, 1.596, 4.3355, 4.0554, 1.728, 5.8218e-05, 5.8218e-05, 5.8218e-05
6
+ 5, 1.7159, 4.0991, 3.4313, 1.7102, 0.00333, 1, 0.995, 0.44754, 0.00333, 1, 0.995, 0.2985, 1.4766, 4.2946, 4.0884, 1.6195, 7.6832e-05, 7.6832e-05, 7.6832e-05
7
+ 6, 2.7119, 5.2866, 4.1508, 3.1172, 0.00333, 1, 0.82833, 0.38996, 0.00333, 1, 0.82833, 0.25308, 1.505, 4.0764, 4.024, 1.6255, 9.505e-05, 9.505e-05, 9.505e-05
8
+ 7, 0.94556, 2.8804, 2.5959, 1.3219, 0.00333, 1, 0.82833, 0.38088, 0.00333, 1, 0.82833, 0.24874, 1.5968, 3.845, 3.9361, 1.742, 0.00011287, 0.00011287, 0.00011287
9
+ 8, 0.70902, 2.7705, 2.8264, 1.1667, 0.00333, 1, 0.4975, 0.21554, 0.00333, 1, 0.4975, 0.15003, 1.4736, 3.8661, 4.0681, 1.7307, 0.0001303, 0.0001303, 0.0001303
10
+ 9, 1.2014, 4.6796, 2.5879, 1.2932, 0.00333, 1, 0.33167, 0.17611, 0.00333, 1, 0.33167, 0.1037, 1.5027, 3.5097, 3.882, 1.8453, 0.00014733, 0.00014733, 0.00014733
11
+ 10, 0.851, 1.0523, 2.4974, 1.0171, 0.00333, 1, 0.22111, 0.10383, 0.00333, 1, 0.22111, 0.07254, 1.4057, 3.4344, 4.1386, 1.7806, 0.00016396, 0.00016396, 0.00016396
12
+ 11, 0.85933, 3.2018, 2.7097, 1.1625, 0.00333, 1, 0.199, 0.09882, 0.00333, 1, 0.199, 0.07965, 1.4053, 3.4217, 4.2842, 1.7831, 0.0001802, 0.0001802, 0.0001802
13
+ 12, 1.1276, 1.9282, 3.6058, 1.2043, 0.00333, 1, 0.22111, 0.08045, 0.00333, 1, 0.22111, 0.0886, 1.3646, 3.5319, 4.2008, 1.7204, 0.00019604, 0.00019604, 0.00019604
14
+ 13, 0.39208, 0.78649, 2.4364, 0.99195, 0.00333, 1, 0.33167, 0.13628, 0.00333, 1, 0.33167, 0.14299, 1.2954, 3.4771, 4.0666, 1.6744, 0.00021149, 0.00021149, 0.00021149
15
+ 14, 1.3241, 1.5904, 2.9146, 1.2394, 0.00333, 1, 0.398, 0.25122, 0.00333, 1, 0.398, 0.2146, 1.1918, 3.0105, 3.804, 1.4393, 0.00022654, 0.00022654, 0.00022654
16
+ 15, 0.96024, 2.0725, 2.1179, 1.0542, 0.00333, 1, 0.4975, 0.34825, 0.00333, 1, 0.4975, 0.2985, 1.1265, 2.4805, 3.5004, 1.2447, 0.00024119, 0.00024119, 0.00024119
17
+ 16, 1.4438, 2.7158, 2.2494, 1.476, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.62179, 1.0437, 2.4469, 3.4711, 1.1619, 0.00025545, 0.00025545, 0.00025545
18
+ 17, 1.467, 1.4591, 2.1486, 1.4093, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.62179, 1.0801, 2.6092, 3.2658, 1.1566, 0.00026931, 0.00026931, 0.00026931
19
+ 18, 0.89688, 1.2424, 1.7795, 1.0991, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.62179, 1.0801, 2.6092, 3.2658, 1.1566, 0.00028278, 0.00028278, 0.00028278
20
+ 19, 0.60214, 0.77793, 1.6414, 0.99689, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.6965, 1.0313, 2.7423, 3.2139, 1.147, 0.00029585, 0.00029585, 0.00029585
21
+ 20, 0.85214, 1.0548, 1.8986, 0.94099, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.6965, 1.0313, 2.7423, 3.2139, 1.147, 0.00030852, 0.00030852, 0.00030852
22
+ 21, 1.4258, 0.95358, 1.8497, 1.2834, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.6965, 0.9573, 2.8966, 3.169, 1.1144, 0.0003208, 0.0003208, 0.0003208
23
+ 22, 0.85004, 1.0574, 1.5009, 0.93669, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.6965, 0.9573, 2.8966, 3.169, 1.1144, 0.00033268, 0.00033268, 0.00033268
24
+ 23, 1.0786, 1.4626, 1.8847, 1.1711, 0.00333, 1, 0.995, 0.796, 0.00333, 1, 0.995, 0.6965, 0.81621, 2.7447, 2.9938, 1.0677, 0.00034417, 0.00034417, 0.00034417
25
+ 24, 0.84179, 1.1373, 1.6472, 1.0215, 0.00333, 1, 0.995, 0.796, 0.00333, 1, 0.995, 0.6965, 0.81621, 2.7447, 2.9938, 1.0677, 0.00035526, 0.00035526, 0.00035526
26
+ 25, 1.452, 2.1495, 1.7875, 1.242, 0.00333, 1, 0.995, 0.796, 0.00333, 1, 0.995, 0.6965, 0.79907, 2.4261, 2.9819, 1.0574, 0.00036595, 0.00036595, 0.00036595
27
+ 26, 0.70379, 0.94091, 1.6053, 0.81501, 0.00333, 1, 0.995, 0.796, 0.00333, 1, 0.995, 0.6965, 0.79907, 2.4261, 2.9819, 1.0574, 0.00037625, 0.00037625, 0.00037625
28
+ 27, 1.2438, 2.3462, 1.9078, 1.2124, 0.00333, 1, 0.995, 0.84554, 0.00333, 1, 0.995, 0.74604, 0.79196, 2.0749, 3.0434, 1.0391, 0.00038615, 0.00038615, 0.00038615
29
+ 28, 1.3626, 1.57, 2.1788, 1.3856, 0.00333, 1, 0.995, 0.84554, 0.00333, 1, 0.995, 0.74604, 0.79196, 2.0749, 3.0434, 1.0391, 0.00039566, 0.00039566, 0.00039566
30
+ 29, 0.60845, 0.86252, 1.3377, 0.90848, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.74604, 1.1332, 1.9465, 3.1372, 1.1639, 0.00040477, 0.00040477, 0.00040477
31
+ 30, 0.41148, 1.0039, 1.4179, 0.80929, 0.00333, 1, 0.995, 0.74604, 0.00333, 1, 0.995, 0.74604, 1.1332, 1.9465, 3.1372, 1.1639, 0.00041348, 0.00041348, 0.00041348
32
+ 31, 1.5436, 1.326, 1.837, 1.1419, 0.00333, 1, 0.4975, 0.31504, 0.00333, 1, 0.4975, 0.398, 1.3916, 1.841, 3.1238, 1.3175, 0.0004218, 0.0004218, 0.0004218
33
+ 32, 0.90931, 0.83464, 1.7748, 1.1598, 0.00333, 1, 0.4975, 0.31504, 0.00333, 1, 0.4975, 0.398, 1.3916, 1.841, 3.1238, 1.3175, 0.00042972, 0.00042972, 0.00042972
34
+ 33, 1.1451, 1.4591, 2.3254, 1.1503, 0.00333, 1, 0.4975, 0.31092, 0.00333, 1, 0.4975, 0.36067, 1.3688, 2.0143, 3.0139, 1.3609, 0.00043725, 0.00043725, 0.00043725
35
+ 34, 1.3743, 2.398, 1.9695, 1.2048, 0.00333, 1, 0.4975, 0.31092, 0.00333, 1, 0.4975, 0.36067, 1.3688, 2.0143, 3.0139, 1.3609, 0.00044438, 0.00044438, 0.00044438
36
+ 35, 0.80273, 1.0339, 1.2745, 1.0503, 0.00333, 1, 0.82833, 0.53008, 0.00333, 1, 0.82833, 0.67921, 1.2645, 2.0833, 3.0578, 1.3413, 0.00045111, 0.00045111, 0.00045111
37
+ 36, 1.0589, 0.95578, 1.4413, 0.98011, 0.00333, 1, 0.82833, 0.53008, 0.00333, 1, 0.82833, 0.67921, 1.2645, 2.0833, 3.0578, 1.3413, 0.00045745, 0.00045745, 0.00045745
38
+ 37, 0.8817, 0.82426, 1.5796, 0.86837, 0.00333, 1, 0.4975, 0.36067, 0.00333, 1, 0.4975, 0.398, 1.2196, 2.3139, 3.0958, 1.2872, 0.00046339, 0.00046339, 0.00046339
39
+ 38, 1.0665, 0.99687, 1.5966, 1.2401, 0.00333, 1, 0.4975, 0.36067, 0.00333, 1, 0.4975, 0.398, 1.2196, 2.3139, 3.0958, 1.2872, 0.00046894, 0.00046894, 0.00046894
40
+ 39, 0.78912, 0.85257, 1.6568, 0.93655, 0.00575, 1, 0.995, 0.796, 0.00575, 1, 0.995, 0.6965, 1.1786, 2.615, 3.1504, 1.2292, 0.00047409, 0.00047409, 0.00047409
41
+ 40, 0.86949, 0.7542, 1.5175, 0.85442, 0.00575, 1, 0.995, 0.796, 0.00575, 1, 0.995, 0.6965, 1.1786, 2.615, 3.1504, 1.2292, 0.00047884, 0.00047884, 0.00047884
42
+ 41, 0.78389, 0.99585, 1.2044, 0.97745, 0.70257, 1, 0.995, 0.84554, 0.70257, 1, 0.995, 0.6969, 0.91375, 3.0332, 2.9817, 1.1804, 0.0004832, 0.0004832, 0.0004832
43
+ 42, 0.93875, 1.0228, 1.5352, 1.0303, 0.70257, 1, 0.995, 0.84554, 0.70257, 1, 0.995, 0.6969, 0.91375, 3.0332, 2.9817, 1.1804, 0.00048716, 0.00048716, 0.00048716
44
+ 43, 0.74866, 0.6317, 1.3008, 1.0709, 0.84087, 1, 0.995, 0.79559, 0.84087, 1, 0.995, 0.74604, 1.0149, 3.3106, 2.8387, 1.2156, 0.00049073, 0.00049073, 0.00049073
45
+ 44, 1.5233, 6.6601, 1.8827, 0.99643, 0.84087, 1, 0.995, 0.79559, 0.84087, 1, 0.995, 0.74604, 1.0149, 3.3106, 2.8387, 1.2156, 0.0004939, 0.0004939, 0.0004939
46
+ 45, 0.90635, 0.60709, 0.97353, 1.1151, 0.89624, 1, 0.995, 0.74604, 0.89624, 1, 0.995, 0.74604, 1.1008, 3.7133, 2.6491, 1.3196, 0.00049667, 0.00049667, 0.00049667
47
+ 46, 1.4365, 1.3927, 1.5401, 1.2655, 0.89624, 1, 0.995, 0.74604, 0.89624, 1, 0.995, 0.74604, 1.1008, 3.7133, 2.6491, 1.3196, 0.00049905, 0.00049905, 0.00049905
48
+ 47, 1.0749, 0.68739, 1.0966, 1.0334, 0.92887, 1, 0.995, 0.69609, 0.92887, 1, 0.995, 0.74604, 1.1825, 5.1113, 2.486, 1.4333, 0.00050103, 0.00050103, 0.00050103
49
+ 48, 0.68106, 0.54396, 1.1069, 0.94829, 0.92887, 1, 0.995, 0.69609, 0.92887, 1, 0.995, 0.74604, 1.1825, 5.1113, 2.486, 1.4333, 0.00050262, 0.00050262, 0.00050262
50
+ 49, 0.87782, 0.5928, 1.105, 1.0292, 0.92799, 1, 0.995, 0.69609, 0.92799, 1, 0.995, 0.74604, 1.1645, 5.7352, 2.4349, 1.4111, 0.00050381, 0.00050381, 0.00050381
51
+ 50, 0.8137, 0.63374, 1.2334, 0.87915, 0.92799, 1, 0.995, 0.69609, 0.92799, 1, 0.995, 0.74604, 1.1645, 5.7352, 2.4349, 1.4111, 0.0005046, 0.0005046, 0.0005046
52
+ 51, 0.78985, 0.64666, 1.8034, 0.96691, 0.9425, 1, 0.995, 0.64654, 0.9425, 1, 0.995, 0.6965, 1.2178, 5.1373, 2.4598, 1.4147, 0.000505, 0.000505, 0.000505
53
+ 52, 1.8706, 1.1905, 1.655, 2.0496, 0.9425, 1, 0.995, 0.64654, 0.9425, 1, 0.995, 0.6965, 1.2178, 5.1373, 2.4598, 1.4147, 0.000505, 0.000505, 0.000505
54
+ 53, 0.86888, 0.77458, 1.6038, 1.0795, 0.9425, 1, 0.995, 0.64654, 0.9425, 1, 0.995, 0.6965, 1.2178, 5.1373, 2.4598, 1.4147, 0.00050461, 0.00050461, 0.00050461
55
+ 54, 1.2279, 1.9082, 1.309, 1.2714, 0.94922, 1, 0.995, 0.54704, 0.94922, 1, 0.995, 0.64654, 1.388, 4.8388, 2.3505, 1.615, 0.00050382, 0.00050382, 0.00050382
56
+ 55, 0.90507, 0.90198, 1.2407, 0.87993, 0.94922, 1, 0.995, 0.54704, 0.94922, 1, 0.995, 0.64654, 1.388, 4.8388, 2.3505, 1.615, 0.00050263, 0.00050263, 0.00050263
57
+ 56, 1.0828, 1.2929, 1.4013, 1.0047, 0.94922, 1, 0.995, 0.54704, 0.94922, 1, 0.995, 0.64654, 1.388, 4.8388, 2.3505, 1.615, 0.00050105, 0.00050105, 0.00050105
58
+ 57, 0.70752, 0.57695, 0.95311, 0.91257, 0.95146, 1, 0.995, 0.54791, 0.95146, 1, 0.995, 0.64766, 1.3503, 4.071, 2.4683, 1.6394, 0.00049907, 0.00049907, 0.00049907
59
+ 58, 0.68851, 0.68347, 1.1073, 1.0301, 0.95146, 1, 0.995, 0.54791, 0.95146, 1, 0.995, 0.64766, 1.3503, 4.071, 2.4683, 1.6394, 0.0004967, 0.0004967, 0.0004967
60
+ 59, 0.66305, 0.62259, 1.2211, 1.0372, 0.95146, 1, 0.995, 0.54791, 0.95146, 1, 0.995, 0.64766, 1.3503, 4.071, 2.4683, 1.6394, 0.00049393, 0.00049393, 0.00049393
61
+ 60, 2.3103, 1.3858, 6.0119, 2.2058, 0.92891, 1, 0.995, 0.74604, 0.92891, 1, 0.995, 0.84554, 1.1143, 3.0818, 2.8376, 1.3999, 0.00049076, 0.00049076, 0.00049076
62
+ 61, 1.3498, 1.4643, 1.823, 1.5928, 0.92891, 1, 0.995, 0.74604, 0.92891, 1, 0.995, 0.84554, 1.1143, 3.0818, 2.8376, 1.3999, 0.0004872, 0.0004872, 0.0004872
63
+ 62, 3.2792, 1.933, 3.5739, 4.7018, 0.92891, 1, 0.995, 0.74604, 0.92891, 1, 0.995, 0.84554, 1.1143, 3.0818, 2.8376, 1.3999, 0.00048324, 0.00048324, 0.00048324
64
+ 63, 1.1019, 1.058, 1.1758, 1.1926, 0.90756, 1, 0.995, 0.79559, 0.90756, 1, 0.995, 0.84554, 0.90423, 2.4638, 3.0234, 1.1968, 0.00047889, 0.00047889, 0.00047889
65
+ 64, 0.97962, 1.6043, 1.5469, 1.0975, 0.90756, 1, 0.995, 0.79559, 0.90756, 1, 0.995, 0.84554, 0.90423, 2.4638, 3.0234, 1.1968, 0.00047414, 0.00047414, 0.00047414
66
+ 65, 0.81335, 0.52585, 1.3577, 0.94185, 0.90756, 1, 0.995, 0.79559, 0.90756, 1, 0.995, 0.84554, 0.90423, 2.4638, 3.0234, 1.1968, 0.00046899, 0.00046899, 0.00046899
67
+ 66, 1.0169, 0.75356, 1.4246, 0.98268, 0.94691, 1, 0.995, 0.79559, 0.94691, 1, 0.995, 0.84554, 0.8756, 2.1998, 2.7105, 1.1501, 0.00046345, 0.00046345, 0.00046345
68
+ 67, 0.80478, 0.66435, 1.8895, 1.0213, 0.94691, 1, 0.995, 0.79559, 0.94691, 1, 0.995, 0.84554, 0.8756, 2.1998, 2.7105, 1.1501, 0.00045751, 0.00045751, 0.00045751
69
+ 68, 0.81323, 0.58879, 1.4506, 1.046, 0.94691, 1, 0.995, 0.79559, 0.94691, 1, 0.995, 0.84554, 0.8756, 2.1998, 2.7105, 1.1501, 0.00045118, 0.00045118, 0.00045118
70
+ 69, 0.98996, 0.83161, 2.1043, 1.0623, 0.97345, 1, 0.995, 0.79559, 0.97345, 1, 0.995, 0.84554, 0.79468, 2.1336, 2.4564, 1.1478, 0.00044445, 0.00044445, 0.00044445
71
+ 70, 0.72026, 0.61927, 1.5673, 0.89035, 0.97345, 1, 0.995, 0.79559, 0.97345, 1, 0.995, 0.84554, 0.79468, 2.1336, 2.4564, 1.1478, 0.00043732, 0.00043732, 0.00043732
72
+ 71, 0.75646, 0.58341, 1.176, 1.0046, 0.97345, 1, 0.995, 0.79559, 0.97345, 1, 0.995, 0.84554, 0.79468, 2.1336, 2.4564, 1.1478, 0.0004298, 0.0004298, 0.0004298
73
+ 72, 0.88943, 0.59326, 1.4413, 1.0473, 0.97785, 1, 0.995, 0.79559, 0.97785, 1, 0.995, 0.84554, 0.83042, 1.9707, 2.5392, 1.1191, 0.00042188, 0.00042188, 0.00042188
74
+ 73, 0.96595, 0.91626, 1.5452, 1.2027, 0.97785, 1, 0.995, 0.79559, 0.97785, 1, 0.995, 0.84554, 0.83042, 1.9707, 2.5392, 1.1191, 0.00041357, 0.00041357, 0.00041357
75
+ 74, 1.0308, 0.54188, 1.3602, 0.97139, 0.97785, 1, 0.995, 0.79559, 0.97785, 1, 0.995, 0.84554, 0.83042, 1.9707, 2.5392, 1.1191, 0.00040486, 0.00040486, 0.00040486
76
+ 75, 0.77662, 0.53955, 1.0961, 1.055, 0.97615, 1, 0.995, 0.74595, 0.97615, 1, 0.995, 0.796, 1.2377, 1.7991, 2.948, 1.2597, 0.00039575, 0.00039575, 0.00039575
77
+ 76, 2.1918, 1.7615, 4.3422, 2.4773, 0.97615, 1, 0.995, 0.74595, 0.97615, 1, 0.995, 0.796, 1.2377, 1.7991, 2.948, 1.2597, 0.00038625, 0.00038625, 0.00038625
78
+ 77, 1.0321, 0.96938, 1.4282, 1.256, 0.97615, 1, 0.995, 0.74595, 0.97615, 1, 0.995, 0.796, 1.2377, 1.7991, 2.948, 1.2597, 0.00037635, 0.00037635, 0.00037635
79
+ 78, 0.88482, 0.86499, 1.1461, 1.1651, 0.97446, 1, 0.995, 0.79559, 0.97446, 1, 0.995, 0.84554, 1.2932, 1.6932, 3.3376, 1.3152, 0.00036606, 0.00036606, 0.00036606
80
+ 79, 0.52308, 0.6066, 1.1131, 0.94784, 0.97446, 1, 0.995, 0.79559, 0.97446, 1, 0.995, 0.84554, 1.2932, 1.6932, 3.3376, 1.3152, 0.00035537, 0.00035537, 0.00035537
81
+ 80, 0.84159, 0.58711, 1.2787, 0.95913, 0.97446, 1, 0.995, 0.79559, 0.97446, 1, 0.995, 0.84554, 1.2932, 1.6932, 3.3376, 1.3152, 0.00034428, 0.00034428, 0.00034428
82
+ 81, 0.62205, 0.80536, 1.0816, 1.1046, 0.97583, 1, 0.995, 0.79559, 0.97583, 1, 0.995, 0.84554, 1.3032, 1.6664, 3.7022, 1.3336, 0.0003328, 0.0003328, 0.0003328
83
+ 82, 0.81451, 1.3413, 1.5002, 0.95115, 0.97583, 1, 0.995, 0.79559, 0.97583, 1, 0.995, 0.84554, 1.3032, 1.6664, 3.7022, 1.3336, 0.00032092, 0.00032092, 0.00032092
84
+ 83, 0.59857, 0.39287, 1.2145, 0.97226, 0.97583, 1, 0.995, 0.79559, 0.97583, 1, 0.995, 0.84554, 1.3032, 1.6664, 3.7022, 1.3336, 0.00030865, 0.00030865, 0.00030865
85
+ 84, 0.93792, 0.68734, 1.2487, 1.0494, 0.97488, 1, 0.995, 0.74604, 0.97488, 1, 0.995, 0.84554, 1.3661, 1.7304, 3.4992, 1.3593, 0.00029598, 0.00029598, 0.00029598
86
+ 85, 1.0459, 0.44648, 1.3996, 1.1949, 0.97488, 1, 0.995, 0.74604, 0.97488, 1, 0.995, 0.84554, 1.3661, 1.7304, 3.4992, 1.3593, 0.00028291, 0.00028291, 0.00028291
87
+ 86, 0.7447, 0.77274, 1.4518, 1.0241, 0.97488, 1, 0.995, 0.74604, 0.97488, 1, 0.995, 0.84554, 1.3661, 1.7304, 3.4992, 1.3593, 0.00026945, 0.00026945, 0.00026945
88
+ 87, 0.99041, 1.0889, 1.2572, 1.0739, 0.97488, 1, 0.995, 0.74604, 0.97488, 1, 0.995, 0.84554, 1.3661, 1.7304, 3.4992, 1.3593, 0.00025559, 0.00025559, 0.00025559
89
+ 88, 0.42205, 0.50047, 1.0638, 0.93963, 0.9748, 1, 0.995, 0.64654, 0.9748, 1, 0.995, 0.796, 1.4629, 1.6961, 3.8926, 1.3942, 0.00024134, 0.00024134, 0.00024134
90
+ 89, 0.62918, 0.59182, 1.3674, 0.93813, 0.9748, 1, 0.995, 0.64654, 0.9748, 1, 0.995, 0.796, 1.4629, 1.6961, 3.8926, 1.3942, 0.00022669, 0.00022669, 0.00022669
91
+ 90, 0.7756, 0.8302, 1.1451, 0.95225, 0.9748, 1, 0.995, 0.64654, 0.9748, 1, 0.995, 0.796, 1.4629, 1.6961, 3.8926, 1.3942, 0.00021164, 0.00021164, 0.00021164
92
+ 91, 0.52194, 0.49158, 1.0642, 0.92605, 0.9748, 1, 0.995, 0.64654, 0.9748, 1, 0.995, 0.796, 1.4629, 1.6961, 3.8926, 1.3942, 0.0001962, 0.0001962, 0.0001962
93
+ 92, 1.0509, 0.61501, 1.3254, 0.94422, 0.97471, 1, 0.995, 0.597, 0.97471, 1, 0.995, 0.796, 1.4953, 1.7121, 3.8751, 1.3854, 0.00018036, 0.00018036, 0.00018036
94
+ 93, 0.69666, 0.60962, 1.5306, 1.032, 0.97471, 1, 0.995, 0.597, 0.97471, 1, 0.995, 0.796, 1.4953, 1.7121, 3.8751, 1.3854, 0.00016413, 0.00016413, 0.00016413
95
+ 94, 0.80135, 1.217, 2.7713, 0.98981, 0.97471, 1, 0.995, 0.597, 0.97471, 1, 0.995, 0.796, 1.4953, 1.7121, 3.8751, 1.3854, 0.0001475, 0.0001475, 0.0001475
96
+ 95, 1.1574, 0.72847, 2.0398, 1.1649, 0.97471, 1, 0.995, 0.597, 0.97471, 1, 0.995, 0.796, 1.4953, 1.7121, 3.8751, 1.3854, 0.00013047, 0.00013047, 0.00013047
97
+ 96, 0.47241, 0.43629, 1.0679, 0.97223, 0.97531, 1, 0.995, 0.54704, 0.97531, 1, 0.995, 0.74604, 1.5015, 1.7038, 3.7367, 1.3879, 0.00011305, 0.00011305, 0.00011305
98
+ 97, 0.66586, 0.41482, 1.5603, 1.1852, 0.97531, 1, 0.995, 0.54704, 0.97531, 1, 0.995, 0.74604, 1.5015, 1.7038, 3.7367, 1.3879, 9.5232e-05, 9.5232e-05, 9.5232e-05
99
+ 98, 0.45151, 0.46226, 1.1479, 0.96591, 0.97531, 1, 0.995, 0.54704, 0.97531, 1, 0.995, 0.74604, 1.5015, 1.7038, 3.7367, 1.3879, 7.7018e-05, 7.7018e-05, 7.7018e-05
100
+ 99, 0.65366, 0.29214, 1.1279, 1.0182, 0.97531, 1, 0.995, 0.54704, 0.97531, 1, 0.995, 0.74604, 1.5015, 1.7038, 3.7367, 1.3879, 5.8408e-05, 5.8408e-05, 5.8408e-05
101
+ 100, 0.57201, 0.40671, 1.0455, 0.7946, 0.97607, 1, 0.995, 0.59658, 0.97607, 1, 0.995, 0.74604, 1.4652, 1.7001, 3.3651, 1.3561, 3.9402e-05, 3.9402e-05, 3.9402e-05
runs/segment/train/results.png ADDED
runs/segment/train/train_batch0.jpg ADDED
runs/segment/train/train_batch1.jpg ADDED
runs/segment/train/train_batch2.jpg ADDED
runs/segment/train/train_batch90.jpg ADDED
runs/segment/train/train_batch91.jpg ADDED
runs/segment/train/train_batch92.jpg ADDED
runs/segment/train/val_batch0_labels.jpg ADDED
runs/segment/train/val_batch0_pred.jpg ADDED
runs/segment/train/weights/best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fcc7eeb5e8305cf0b0ac79b73bea0849a86e851985fd63e926c116c3191b81e
3
+ size 6789155
runs/segment/train/weights/best.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6b8b2e2c19a43af3a8bd2e125b9992890c78f0889c3645cefde8d277892eb9e
3
+ size 12293407
runs/segment/train/weights/last.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca46daa15e0977bd983e74e5b3e1c2b78fed3578be6df1967a3945f53b1118ef
3
+ size 6791843
runs/segment/val/BoxF1_curve.png ADDED
runs/segment/val/BoxPR_curve.png ADDED
runs/segment/val/BoxP_curve.png ADDED
runs/segment/val/BoxR_curve.png ADDED
runs/segment/val/MaskF1_curve.png ADDED
runs/segment/val/MaskPR_curve.png ADDED
runs/segment/val/MaskP_curve.png ADDED
runs/segment/val/MaskR_curve.png ADDED
runs/segment/val/confusion_matrix.png ADDED
runs/segment/val/confusion_matrix_normalized.png ADDED
runs/segment/val/val_batch0_labels.jpg ADDED
runs/segment/val/val_batch0_pred.jpg ADDED
src/controllers/__pycache__/sack_detector.cpython-310.pyc ADDED
Binary file (1.3 kB). View file
 
src/controllers/sack_detector.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ from ultralytics import YOLO
3
+
4
+ from src.handlers.image_processing import draw_box, resize_image
5
+
6
+ import os
7
+ from dotenv import load_dotenv
8
+ load_dotenv()
9
+
10
+ class SackDetector:
11
+ def __init__(self):
12
+ self.model_path = os.getenv("YOLO_MODEL_PATH", None) # Default path
13
+ if self.model_path is None:
14
+ raise ValueError("YOLO_MODEL_PATH environment variable is not set.")
15
+ self.model = YOLO(self.model_path)
16
+ self.class_list = self.model.model.names
17
+
18
+ def detect_objects(self, image_path):
19
+ results = self.model(image_path)
20
+ result = results[0]
21
+ labeled_img = draw_box(result.orig_img, result, self.class_list)
22
+ # display_img = resize_image(labeled_img, 100)
23
+ return labeled_img, result
24
+
25
+ def display_image(self, image):
26
+ cv2.imshow('outputimage', image)
27
+ cv2.waitKey(0) # Wait for user input to close the window
src/handlers/__pycache__/image_processing.cpython-310.pyc ADDED
Binary file (1.58 kB). View file
 
src/handlers/image_processing.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+
3
+ def resize_image(img, scale_percent) :
4
+ # Calculate new size
5
+ width = int(img.shape[1] * scale_percent / 100)
6
+ height = int(img.shape[0] * scale_percent / 100)
7
+ dim = (width, height)
8
+ # Resize image
9
+ resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
10
+ return resized
11
+
12
+ def draw_box(img, result, class_list) :
13
+ # Get information from result
14
+ xyxy= result.boxes.xyxy.numpy()
15
+ confidence= result.boxes.conf.numpy()
16
+ class_id= result.boxes.cls.numpy().astype(int)
17
+ # Get Class name
18
+ class_name = [class_list[x] for x in class_id]
19
+ # Pack together for easy use
20
+ sum_output = list(zip(class_name, confidence,xyxy))
21
+ # Copy image, in case that we need original image for something
22
+ out_image = img.copy()
23
+ for run_output in sum_output :
24
+ # Unpack
25
+ label, con, box = run_output
26
+ # Choose color
27
+ box_color = (0, 0, 255)
28
+ text_color = (255,255,255)
29
+ # Draw object box
30
+ first_half_box = (int(box[0]),int(box[1]))
31
+ second_half_box = (int(box[2]),int(box[3]))
32
+ cv2.rectangle(out_image, first_half_box, second_half_box, box_color, 2)
33
+ # Create text
34
+ text_print = '{label} {con:.2f}'.format(label = label, con = con)
35
+ # Locate text position
36
+ text_location = (int(box[0]), int(box[1] - 10 ))
37
+ # Get size and baseline
38
+ labelSize, baseLine = cv2.getTextSize(text_print, cv2.FONT_HERSHEY_SIMPLEX, 1, 2)
39
+ # Draw text's background
40
+ cv2.rectangle(out_image
41
+ , (int(box[0]), int(box[1] - labelSize[1] - 10 ))
42
+ , (int(box[0])+labelSize[0], int(box[1] + baseLine-10))
43
+ , box_color , cv2.FILLED)
44
+ # Put text
45
+ cv2.putText(out_image, text_print ,text_location
46
+ , cv2.FONT_HERSHEY_SIMPLEX , 1
47
+ , text_color, 2 ,cv2.LINE_AA)
48
+ return out_image