diff --git a/ros2_ws/src/yolov3/runs/train/exp15/F1_curve.png b/ros2_ws/src/yolov3/runs/train/exp15/F1_curve.png deleted file mode 100644 index 5298b41a..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/F1_curve.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/PR_curve.png b/ros2_ws/src/yolov3/runs/train/exp15/PR_curve.png deleted file mode 100644 index 4b9b126b..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/PR_curve.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/P_curve.png b/ros2_ws/src/yolov3/runs/train/exp15/P_curve.png deleted file mode 100644 index cf99139d..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/P_curve.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/R_curve.png b/ros2_ws/src/yolov3/runs/train/exp15/R_curve.png deleted file mode 100644 index 8bde6d7a..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/R_curve.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/confusion_matrix.png b/ros2_ws/src/yolov3/runs/train/exp15/confusion_matrix.png deleted file mode 100644 index e63322cf..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/confusion_matrix.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/events.out.tfevents.1679397704.3367b61a0909.4261.0 b/ros2_ws/src/yolov3/runs/train/exp15/events.out.tfevents.1679397704.3367b61a0909.4261.0 deleted file mode 100644 index 4af0776a..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/events.out.tfevents.1679397704.3367b61a0909.4261.0 and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/hyp.yaml b/ros2_ws/src/yolov3/runs/train/exp15/hyp.yaml deleted file mode 100644 index b54281de..00000000 --- a/ros2_ws/src/yolov3/runs/train/exp15/hyp.yaml +++ /dev/null @@ -1,28 +0,0 @@ -lr0: 0.01 -lrf: 0.1 -momentum: 0.937 -weight_decay: 0.0005 -warmup_epochs: 3.0 -warmup_momentum: 0.8 -warmup_bias_lr: 0.1 -box: 0.05 -cls: 0.5 -cls_pw: 1.0 -obj: 1.0 -obj_pw: 1.0 -iou_t: 0.2 -anchor_t: 4.0 -fl_gamma: 0.0 -hsv_h: 0.015 -hsv_s: 0.7 -hsv_v: 0.4 -degrees: 0.0 -translate: 0.1 -scale: 0.5 -shear: 0.0 -perspective: 0.0 -flipud: 0.0 -fliplr: 0.5 -mosaic: 1.0 -mixup: 0.0 -copy_paste: 0.0 diff --git a/ros2_ws/src/yolov3/runs/train/exp15/labels.jpg b/ros2_ws/src/yolov3/runs/train/exp15/labels.jpg deleted file mode 100644 index f93da911..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/labels.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/labels_correlogram.jpg b/ros2_ws/src/yolov3/runs/train/exp15/labels_correlogram.jpg deleted file mode 100644 index 1ed48e18..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/labels_correlogram.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/opt.yaml b/ros2_ws/src/yolov3/runs/train/exp15/opt.yaml deleted file mode 100644 index 6a5b5b37..00000000 --- a/ros2_ws/src/yolov3/runs/train/exp15/opt.yaml +++ /dev/null @@ -1,37 +0,0 @@ -weights: '' -cfg: /content/gdrive/MyDrive/yolov3/models/yolov3.yaml -data: data/custom-yolov3.yaml -hyp: data/hyps/hyp.scratch.yaml -epochs: 300 -batch_size: 16 -imgsz: 1280 -rect: false -resume: false -nosave: false -noval: false -noautoanchor: false -evolve: null -bucket: '' -cache: null -image_weights: false -device: '' -multi_scale: false -single_cls: false -adam: false -sync_bn: false -workers: 8 -project: runs/train -name: exp -exist_ok: false -quad: false -linear_lr: false -label_smoothing: 0.0 -patience: 100 -freeze: 0 -save_period: -1 -local_rank: -1 -entity: null -upload_dataset: false -bbox_interval: -1 -artifact_alias: latest -save_dir: runs/train/exp15 diff --git a/ros2_ws/src/yolov3/runs/train/exp15/results.csv b/ros2_ws/src/yolov3/runs/train/exp15/results.csv deleted file mode 100644 index b1143152..00000000 --- a/ros2_ws/src/yolov3/runs/train/exp15/results.csv +++ /dev/null @@ -1,301 +0,0 @@ - epoch, train/box_loss, train/obj_loss, train/cls_loss, metrics/precision, metrics/recall, metrics/mAP_0.5,metrics/mAP_0.5:0.95, val/box_loss, val/obj_loss, val/cls_loss, x/lr0, x/lr1, x/lr2 - 0, 0.1072, 0.089784, 0.045148, 3.1447e-05, 0.009434, 1.7021e-05, 1.7021e-06, 0.074383, 0.071557, 0.036102, 0.00019, 0.00019, 0.09829 - 1, 0.09357, 0.073808, 0.04392, 6.2893e-05, 0.018868, 3.5032e-05, 6.2107e-06, 0.069977, 0.066751, 0.035672, 0.00038999, 0.00038999, 0.09649 - 2, 0.082933, 0.073286, 0.042061, 6.2893e-05, 0.018868, 3.5252e-05, 3.5252e-06, 0.067869, 0.065488, 0.035208, 0.00058994, 0.00058994, 0.09469 - 3, 0.078388, 0.073047, 0.042215, 9.434e-05, 0.028302, 5.6751e-05, 5.6751e-06, 0.067291, 0.064494, 0.034919, 0.00078982, 0.00078982, 0.09289 - 4, 0.077606, 0.066943, 0.040052, 9.434e-05, 0.028302, 5.7173e-05, 9.217e-06, 0.065971, 0.064303, 0.034521, 0.00098961, 0.00098961, 0.09109 - 5, 0.073009, 0.072096, 0.039418, 0.0010693, 0.082038, 0.00067087, 0.00010067, 0.065407, 0.064251, 0.034196, 0.0011893, 0.0011893, 0.089289 - 6, 0.074801, 0.071712, 0.039586, 0.0010178, 0.16158, 0.00093658, 0.00021294, 0.065921, 0.063458, 0.033979, 0.0013888, 0.0013888, 0.087489 - 7, 0.076127, 0.0702, 0.039439, 0.00084618, 0.17629, 0.0011685, 0.00023231, 0.065714, 0.063461, 0.033674, 0.0015881, 0.0015881, 0.085688 - 8, 0.075849, 0.074078, 0.038786, 0.0092778, 0.030889, 0.0032644, 0.00070873, 0.065679, 0.062307, 0.030542, 0.0017872, 0.0017872, 0.083887 - 9, 0.075436, 0.069392, 0.038983, 0.0060257, 0.10055, 0.0033271, 0.00079476, 0.064516, 0.062611, 0.030316, 0.001986, 0.001986, 0.082086 - 10, 0.077201, 0.071009, 0.035982, 0.015542, 0.070484, 0.005924, 0.0010521, 0.070791, 0.061645, 0.026312, 0.0021846, 0.0021846, 0.080285 - 11, 0.07411, 0.067135, 0.036761, 0.54391, 0.014074, 0.0064732, 0.0012823, 0.079597, 0.077907, 0.033935, 0.0023829, 0.0023829, 0.078483 - 12, 0.072703, 0.066995, 0.036249, 0.015042, 0.15315, 0.0083551, 0.0012464, 0.075651, 0.067622, 0.028427, 0.0025808, 0.0025808, 0.076681 - 13, 0.0737, 0.072585, 0.03594, 0.038881, 0.15844, 0.020356, 0.0033538, 0.063492, 0.061259, 0.026789, 0.0027784, 0.0027784, 0.074878 - 14, 0.072014, 0.072332, 0.036173, 0.036296, 0.10895, 0.018669, 0.003782, 0.061362, 0.061768, 0.026689, 0.0029756, 0.0029756, 0.073076 - 15, 0.072346, 0.071417, 0.033542, 0.090208, 0.14203, 0.0267, 0.0043627, 0.062477, 0.06224, 0.024864, 0.0031723, 0.0031723, 0.071272 - 16, 0.070106, 0.068058, 0.034502, 0.067812, 0.14637, 0.037359, 0.0078725, 0.06237, 0.061756, 0.02467, 0.0033686, 0.0033686, 0.069469 - 17, 0.074946, 0.064136, 0.032574, 0.13835, 0.12299, 0.072165, 0.012966, 0.058928, 0.05861, 0.024038, 0.0035645, 0.0035645, 0.067664 - 18, 0.070358, 0.060051, 0.031907, 0.0479, 0.25203, 0.038178, 0.0060513, 0.05915, 0.058207, 0.025925, 0.0037598, 0.0037598, 0.06586 - 19, 0.067322, 0.055626, 0.03065, 0.82252, 0.060739, 0.063727, 0.012951, 0.065587, 0.053063, 0.021251, 0.0039546, 0.0039546, 0.064055 - 20, 0.068843, 0.057321, 0.030782, 0.18588, 0.17522, 0.10052, 0.0231, 0.057125, 0.052086, 0.021309, 0.0041488, 0.0041488, 0.062249 - 21, 0.06779, 0.056333, 0.030423, 0.14705, 0.2448, 0.14866, 0.026988, 0.057788, 0.054503, 0.020962, 0.0043424, 0.0043424, 0.060442 - 22, 0.065426, 0.052589, 0.030872, 0.31674, 0.30232, 0.25582, 0.068044, 0.051682, 0.048209, 0.020117, 0.0045354, 0.0045354, 0.058635 - 23, 0.067626, 0.056669, 0.027687, 0.10589, 0.17271, 0.068596, 0.015701, 0.064839, 0.051478, 0.020254, 0.0047278, 0.0047278, 0.056828 - 24, 0.059718, 0.052035, 0.026036, 0.42306, 0.42077, 0.40239, 0.11784, 0.055993, 0.041789, 0.015245, 0.0049195, 0.0049195, 0.055019 - 25, 0.066427, 0.060109, 0.026517, 0.21072, 0.40616, 0.23959, 0.044691, 0.060816, 0.050553, 0.017379, 0.0051104, 0.0051104, 0.05321 - 26, 0.068186, 0.057706, 0.026478, 0.14783, 0.51256, 0.19894, 0.060068, 0.057491, 0.04908, 0.018394, 0.0053007, 0.0053007, 0.051401 - 27, 0.066612, 0.050319, 0.024494, 0.48579, 0.42298, 0.40479, 0.11374, 0.056078, 0.045788, 0.014807, 0.0054901, 0.0054901, 0.04959 - 28, 0.063534, 0.052454, 0.024039, 0.40719, 0.36156, 0.30722, 0.10794, 0.055933, 0.046081, 0.021163, 0.0056788, 0.0056788, 0.047779 - 29, 0.063979, 0.050578, 0.023715, 0.11747, 0.27502, 0.089202, 0.017614, 0.058407, 0.055614, 0.019128, 0.0058667, 0.0058667, 0.045967 - 30, 0.061931, 0.04879, 0.021555, 0.097, 0.14031, 0.055955, 0.0091582, 0.056716, 0.063297, 0.024825, 0.0060537, 0.0060537, 0.044154 - 31, 0.057106, 0.050596, 0.020186, 0.46931, 0.63839, 0.47727, 0.14214, 0.047358, 0.044311, 0.013691, 0.0062398, 0.0062398, 0.04234 - 32, 0.061115, 0.046957, 0.020035, 0.63103, 0.71706, 0.687, 0.25922, 0.046848, 0.037924, 0.011027, 0.006425, 0.006425, 0.040525 - 33, 0.056406, 0.046535, 0.01865, 0.43884, 0.62161, 0.51021, 0.17632, 0.05008, 0.038613, 0.014262, 0.0066094, 0.0066094, 0.038709 - 34, 0.059193, 0.048328, 0.019087, 0.40999, 0.66487, 0.53293, 0.19979, 0.047951, 0.038267, 0.0089096, 0.0067927, 0.0067927, 0.036893 - 35, 0.058858, 0.046026, 0.018089, 0.49914, 0.45985, 0.44086, 0.14173, 0.055914, 0.049698, 0.016622, 0.0069751, 0.0069751, 0.035075 - 36, 0.05378, 0.046878, 0.017436, 0.54042, 0.40374, 0.42118, 0.12772, 0.053832, 0.048224, 0.015295, 0.0071565, 0.0071565, 0.033256 - 37, 0.057157, 0.047375, 0.01825, 0.45283, 0.17341, 0.1188, 0.023888, 0.05297, 0.06591, 0.028537, 0.0073368, 0.0073368, 0.031437 - 38, 0.055086, 0.044643, 0.016019, 0.59048, 0.58181, 0.54786, 0.20768, 0.046944, 0.041786, 0.011842, 0.0075161, 0.0075161, 0.029616 - 39, 0.052514, 0.042485, 0.016678, 0.60654, 0.62859, 0.65293, 0.27689, 0.04138, 0.043998, 0.0078349, 0.0076943, 0.0076943, 0.027794 - 40, 0.054016, 0.045163, 0.016713, 0.43989, 0.24508, 0.23914, 0.074126, 0.052986, 0.055093, 0.029361, 0.0078714, 0.0078714, 0.025971 - 41, 0.052897, 0.042598, 0.014125, 0.66111, 0.45699, 0.54765, 0.20954, 0.04524, 0.048015, 0.013144, 0.0080473, 0.0080473, 0.024147 - 42, 0.051021, 0.042313, 0.012967, 0.64228, 0.50983, 0.5556, 0.2054, 0.049423, 0.04853, 0.014758, 0.0082221, 0.0082221, 0.022322 - 43, 0.05275, 0.041908, 0.012555, 0.76316, 0.7306, 0.72312, 0.21781, 0.046986, 0.032759, 0.0042896, 0.0083957, 0.0083957, 0.020496 - 44, 0.052692, 0.040748, 0.012202, 0.73323, 0.7009, 0.74501, 0.32735, 0.040507, 0.036143, 0.0074856, 0.0085681, 0.0085681, 0.018668 - 45, 0.051049, 0.040343, 0.010494, 0.79341, 0.8425, 0.8331, 0.38394, 0.042813, 0.033749, 0.0054575, 0.0087393, 0.0087393, 0.016839 - 46, 0.052916, 0.04602, 0.016315, 0.0074664, 0.36345, 0.0069738, 0.0012171, 0.071852, 0.057659, 0.040379, 0.0089092, 0.0089092, 0.015009 - 47, 0.061261, 0.055108, 0.025584, 0, 0, 0, 0, 0.10342, 0.10308, 0.61562, 0.0090778, 0.0090778, 0.013178 - 48, 0.055741, 0.048942, 0.022914, 0, 0, 0, 0, 0.091703, 0.15503, 0.50829, 0.0092451, 0.0092451, 0.011345 - 49, 0.055505, 0.046065, 0.01996, 0.40454, 0.43583, 0.36731, 0.1155, 0.054668, 0.048338, 0.01677, 0.009411, 0.009411, 0.009511 - 50, 0.052316, 0.04637, 0.01857, 0.29994, 0.17425, 0.1908, 0.069672, 0.061657, 0.058302, 0.017473, 0.0093971, 0.0093971, 0.0093971 - 51, 0.052513, 0.044853, 0.016164, 0.32316, 0.21994, 0.18133, 0.052024, 0.054571, 0.052566, 0.018779, 0.0093971, 0.0093971, 0.0093971 - 52, 0.050169, 0.041122, 0.013702, 0.71349, 0.46749, 0.50083, 0.20943, 0.05027, 0.040049, 0.0090618, 0.0093733, 0.0093733, 0.0093733 - 53, 0.052356, 0.038377, 0.012993, 0.70745, 0.58166, 0.63794, 0.29499, 0.043828, 0.039433, 0.006337, 0.0093491, 0.0093491, 0.0093491 - 54, 0.049593, 0.041015, 0.013021, 0.8286, 0.83119, 0.85701, 0.39813, 0.044484, 0.031344, 0.0039315, 0.0093245, 0.0093245, 0.0093245 - 55, 0.050457, 0.040325, 0.011648, 0.90411, 0.72727, 0.81333, 0.32555, 0.050267, 0.031773, 0.0036776, 0.0092995, 0.0092995, 0.0092995 - 56, 0.048361, 0.037615, 0.01134, 0.83214, 0.70918, 0.7804, 0.32044, 0.048583, 0.035312, 0.0075229, 0.009274, 0.009274, 0.009274 - 57, 0.045264, 0.037444, 0.010766, 0.73705, 0.60835, 0.67841, 0.33454, 0.037938, 0.035844, 0.011167, 0.0092481, 0.0092481, 0.0092481 - 58, 0.048281, 0.038769, 0.0095906, 0.77539, 0.72818, 0.77761, 0.35702, 0.038495, 0.033515, 0.0052658, 0.0092219, 0.0092219, 0.0092219 - 59, 0.045365, 0.036449, 0.0083486, 0.84428, 0.80126, 0.86356, 0.45554, 0.039402, 0.029563, 0.00649, 0.0091952, 0.0091952, 0.0091952 - 60, 0.047082, 0.038087, 0.01002, 0.82263, 0.84693, 0.89213, 0.45806, 0.038933, 0.03161, 0.0054989, 0.0091681, 0.0091681, 0.0091681 - 61, 0.043742, 0.036556, 0.0088003, 0.92037, 0.8607, 0.9257, 0.48197, 0.036326, 0.030955, 0.0034465, 0.0091406, 0.0091406, 0.0091406 - 62, 0.044255, 0.036951, 0.010437, 0.87895, 0.89227, 0.91443, 0.44407, 0.043374, 0.028684, 0.0026665, 0.0091127, 0.0091127, 0.0091127 - 63, 0.045161, 0.03555, 0.0089086, 0.92405, 0.88652, 0.91847, 0.5026, 0.039014, 0.030431, 0.0025694, 0.0090844, 0.0090844, 0.0090844 - 64, 0.045083, 0.037143, 0.0087739, 0.93807, 0.88789, 0.93251, 0.48687, 0.041815, 0.028742, 0.002422, 0.0090557, 0.0090557, 0.0090557 - 65, 0.040342, 0.037515, 0.0077562, 0.92831, 0.92405, 0.95091, 0.55001, 0.033787, 0.028646, 0.0023556, 0.0090266, 0.0090266, 0.0090266 - 66, 0.044417, 0.032584, 0.0076607, 0.92958, 0.86946, 0.92922, 0.53225, 0.035044, 0.028907, 0.0025468, 0.0089972, 0.0089972, 0.0089972 - 67, 0.039694, 0.035995, 0.0079306, 0.88746, 0.90617, 0.92104, 0.51225, 0.035307, 0.027231, 0.003196, 0.0089673, 0.0089673, 0.0089673 - 68, 0.044565, 0.034608, 0.0088018, 0.87307, 0.84145, 0.90489, 0.50325, 0.034845, 0.032796, 0.0049277, 0.0089371, 0.0089371, 0.0089371 - 69, 0.042965, 0.033984, 0.01085, 0.9106, 0.85758, 0.91816, 0.51602, 0.035491, 0.030649, 0.0044527, 0.0089065, 0.0089065, 0.0089065 - 70, 0.04196, 0.035426, 0.0084481, 0.86355, 0.90502, 0.92138, 0.55436, 0.032832, 0.029249, 0.0028974, 0.0088755, 0.0088755, 0.0088755 - 71, 0.038512, 0.036, 0.0078214, 0.94121, 0.89692, 0.94946, 0.54232, 0.035271, 0.027604, 0.0020984, 0.0088442, 0.0088442, 0.0088442 - 72, 0.041711, 0.035849, 0.0077841, 0.94633, 0.90146, 0.94532, 0.55551, 0.034369, 0.028245, 0.0028688, 0.0088124, 0.0088124, 0.0088124 - 73, 0.043422, 0.034141, 0.008423, 0.89791, 0.79773, 0.89551, 0.49783, 0.036391, 0.032343, 0.0036569, 0.0087804, 0.0087804, 0.0087804 - 74, 0.041125, 0.034275, 0.0088747, 0.94643, 0.86711, 0.9366, 0.54438, 0.031141, 0.029405, 0.0027034, 0.0087479, 0.0087479, 0.0087479 - 75, 0.039719, 0.034131, 0.0079598, 0.9524, 0.91862, 0.9582, 0.59485, 0.03173, 0.026338, 0.0019864, 0.0087151, 0.0087151, 0.0087151 - 76, 0.040181, 0.033154, 0.0080667, 0.90734, 0.83848, 0.92208, 0.47094, 0.038296, 0.031134, 0.0040538, 0.008682, 0.008682, 0.008682 - 77, 0.03966, 0.033198, 0.0066327, 0.94442, 0.86113, 0.92597, 0.45845, 0.035619, 0.028766, 0.0026854, 0.0086485, 0.0086485, 0.0086485 - 78, 0.038331, 0.034961, 0.0069487, 0.91974, 0.89982, 0.94746, 0.51601, 0.034682, 0.02985, 0.0028031, 0.0086146, 0.0086146, 0.0086146 - 79, 0.038131, 0.034181, 0.0070184, 0.9505, 0.92209, 0.95505, 0.56273, 0.031882, 0.030202, 0.0025396, 0.0085805, 0.0085805, 0.0085805 - 80, 0.037099, 0.033424, 0.0061094, 0.95886, 0.9318, 0.94569, 0.56409, 0.031647, 0.027277, 0.0028533, 0.0085459, 0.0085459, 0.0085459 - 81, 0.038213, 0.035, 0.0062455, 0.90117, 0.91763, 0.93225, 0.58747, 0.030732, 0.026239, 0.0024431, 0.0085111, 0.0085111, 0.0085111 - 82, 0.038884, 0.031852, 0.0060274, 0.94817, 0.92094, 0.95121, 0.55533, 0.031829, 0.026745, 0.0023725, 0.0084759, 0.0084759, 0.0084759 - 83, 0.036625, 0.033138, 0.0079261, 0.95916, 0.91625, 0.94151, 0.5457, 0.034776, 0.026776, 0.0021613, 0.0084404, 0.0084404, 0.0084404 - 84, 0.038809, 0.032023, 0.0062357, 0.93504, 0.92504, 0.95141, 0.58087, 0.033784, 0.026052, 0.0023802, 0.0084046, 0.0084046, 0.0084046 - 85, 0.037893, 0.034964, 0.0068261, 0.92978, 0.93218, 0.95634, 0.58927, 0.031465, 0.026274, 0.0021452, 0.0083684, 0.0083684, 0.0083684 - 86, 0.038298, 0.033131, 0.0060222, 0.94402, 0.95637, 0.96109, 0.55015, 0.033578, 0.028523, 0.002081, 0.0083319, 0.0083319, 0.0083319 - 87, 0.037152, 0.034427, 0.0058415, 0.93586, 0.91752, 0.94697, 0.59167, 0.030662, 0.027937, 0.0022087, 0.0082952, 0.0082952, 0.0082952 - 88, 0.033444, 0.033919, 0.0065007, 0.97881, 0.93894, 0.95851, 0.60322, 0.031015, 0.025488, 0.0023777, 0.0082581, 0.0082581, 0.0082581 - 89, 0.034102, 0.033245, 0.006238, 0.97284, 0.92101, 0.95236, 0.58836, 0.031254, 0.026429, 0.0026268, 0.0082207, 0.0082207, 0.0082207 - 90, 0.033522, 0.03244, 0.0050727, 0.96762, 0.87823, 0.94835, 0.59588, 0.029, 0.026984, 0.003767, 0.008183, 0.008183, 0.008183 - 91, 0.034385, 0.03257, 0.0068179, 0.96143, 0.94048, 0.96293, 0.61393, 0.032598, 0.025748, 0.0025069, 0.008145, 0.008145, 0.008145 - 92, 0.038411, 0.03149, 0.008301, 0.85757, 0.82488, 0.90553, 0.50806, 0.03392, 0.030222, 0.0066837, 0.0081068, 0.0081068, 0.0081068 - 93, 0.038098, 0.030603, 0.0062063, 0.87368, 0.83447, 0.8986, 0.48715, 0.032855, 0.030639, 0.0038948, 0.0080682, 0.0080682, 0.0080682 - 94, 0.038408, 0.031401, 0.0071762, 0.97569, 0.88239, 0.94377, 0.57059, 0.032335, 0.027143, 0.0022352, 0.0080294, 0.0080294, 0.0080294 - 95, 0.037455, 0.031985, 0.0056255, 0.92462, 0.91911, 0.95528, 0.57158, 0.032933, 0.02751, 0.0028774, 0.0079903, 0.0079903, 0.0079903 - 96, 0.034081, 0.032974, 0.0055842, 0.95494, 0.95877, 0.96191, 0.56896, 0.031626, 0.02607, 0.0021001, 0.0079509, 0.0079509, 0.0079509 - 97, 0.036189, 0.031882, 0.0066565, 0.95704, 0.92485, 0.96058, 0.61761, 0.031169, 0.024964, 0.0026779, 0.0079112, 0.0079112, 0.0079112 - 98, 0.034716, 0.033089, 0.0062765, 0.95208, 0.9259, 0.95999, 0.58112, 0.031563, 0.025833, 0.002693, 0.0078713, 0.0078713, 0.0078713 - 99, 0.035807, 0.032488, 0.0062112, 0.94346, 0.93805, 0.95484, 0.58984, 0.030902, 0.025948, 0.0019203, 0.0078311, 0.0078311, 0.0078311 - 100, 0.035404, 0.030942, 0.0070651, 0.90669, 0.90848, 0.94371, 0.55885, 0.032847, 0.031035, 0.0054341, 0.0077907, 0.0077907, 0.0077907 - 101, 0.034805, 0.032716, 0.007314, 0.95797, 0.95318, 0.96146, 0.57165, 0.031743, 0.027374, 0.0019765, 0.00775, 0.00775, 0.00775 - 102, 0.036556, 0.032288, 0.0068758, 0.93197, 0.95396, 0.96154, 0.58878, 0.030179, 0.028715, 0.0022038, 0.0077091, 0.0077091, 0.0077091 - 103, 0.034745, 0.03311, 0.0060098, 0.91789, 0.95751, 0.9557, 0.60553, 0.030048, 0.028515, 0.0018339, 0.0076679, 0.0076679, 0.0076679 - 104, 0.035191, 0.032241, 0.0060717, 0.89044, 0.92859, 0.9459, 0.55454, 0.031789, 0.029479, 0.0041273, 0.0076265, 0.0076265, 0.0076265 - 105, 0.035232, 0.030591, 0.0058525, 0.88359, 0.89753, 0.93313, 0.58269, 0.030801, 0.027946, 0.0030299, 0.0075848, 0.0075848, 0.0075848 - 106, 0.034891, 0.031808, 0.0054986, 0.92895, 0.85635, 0.92882, 0.49609, 0.034223, 0.029069, 0.0034086, 0.007543, 0.007543, 0.007543 - 107, 0.034206, 0.032183, 0.0059379, 0.95328, 0.90682, 0.95609, 0.5899, 0.032747, 0.02519, 0.002409, 0.0075009, 0.0075009, 0.0075009 - 108, 0.035193, 0.032691, 0.006186, 0.76003, 0.88884, 0.92562, 0.52785, 0.033637, 0.027941, 0.0085591, 0.0074585, 0.0074585, 0.0074585 - 109, 0.032678, 0.031774, 0.0051808, 0.9394, 0.94668, 0.95971, 0.59036, 0.029259, 0.025816, 0.0018039, 0.007416, 0.007416, 0.007416 - 110, 0.034928, 0.032253, 0.0052045, 0.96947, 0.9156, 0.95994, 0.57839, 0.031965, 0.025841, 0.0017381, 0.0073733, 0.0073733, 0.0073733 - 111, 0.032909, 0.030654, 0.0068091, 0.93353, 0.9431, 0.95796, 0.6155, 0.029402, 0.024355, 0.00166, 0.0073303, 0.0073303, 0.0073303 - 112, 0.034421, 0.030596, 0.0056472, 0.97009, 0.96553, 0.96802, 0.62231, 0.027934, 0.024545, 0.0017626, 0.0072872, 0.0072872, 0.0072872 - 113, 0.033877, 0.031202, 0.0048802, 0.96084, 0.94522, 0.95601, 0.59425, 0.029266, 0.025481, 0.0019383, 0.0072438, 0.0072438, 0.0072438 - 114, 0.032888, 0.030615, 0.0059414, 0.96707, 0.96629, 0.96299, 0.58985, 0.028752, 0.02581, 0.001971, 0.0072003, 0.0072003, 0.0072003 - 115, 0.033697, 0.032449, 0.0059314, 0.98178, 0.96195, 0.96413, 0.62237, 0.030004, 0.025665, 0.0022348, 0.0071566, 0.0071566, 0.0071566 - 116, 0.032169, 0.028243, 0.0053777, 0.96855, 0.95665, 0.96663, 0.59072, 0.030777, 0.027957, 0.0025654, 0.0071127, 0.0071127, 0.0071127 - 117, 0.031322, 0.029406, 0.0044561, 0.95818, 0.95873, 0.96789, 0.61904, 0.03089, 0.02532, 0.0023165, 0.0070686, 0.0070686, 0.0070686 - 118, 0.032621, 0.031882, 0.0060545, 0.96766, 0.9703, 0.97043, 0.61416, 0.031658, 0.02589, 0.0024626, 0.0070243, 0.0070243, 0.0070243 - 119, 0.033223, 0.027714, 0.0065067, 0.98299, 0.96548, 0.96768, 0.62695, 0.029253, 0.02492, 0.0019283, 0.0069799, 0.0069799, 0.0069799 - 120, 0.033553, 0.029447, 0.0063224, 0.98701, 0.95656, 0.96794, 0.64578, 0.027592, 0.02491, 0.0018422, 0.0069353, 0.0069353, 0.0069353 - 121, 0.03325, 0.028541, 0.0051204, 0.98317, 0.93651, 0.96604, 0.61816, 0.032385, 0.023813, 0.0019208, 0.0068906, 0.0068906, 0.0068906 - 122, 0.033097, 0.02979, 0.0057041, 0.97144, 0.93651, 0.96183, 0.61828, 0.027016, 0.026034, 0.0019498, 0.0068457, 0.0068457, 0.0068457 - 123, 0.032385, 0.031679, 0.0052411, 0.97262, 0.94493, 0.96298, 0.62283, 0.026364, 0.025603, 0.0019448, 0.0068006, 0.0068006, 0.0068006 - 124, 0.033781, 0.029724, 0.0050386, 0.95657, 0.95188, 0.96177, 0.64612, 0.028362, 0.024317, 0.0019741, 0.0067555, 0.0067555, 0.0067555 - 125, 0.032106, 0.029237, 0.0045665, 0.94958, 0.9452, 0.96075, 0.64017, 0.028601, 0.024065, 0.0021955, 0.0067101, 0.0067101, 0.0067101 - 126, 0.032264, 0.029086, 0.0054842, 0.95887, 0.96354, 0.96768, 0.66344, 0.026937, 0.023887, 0.0024299, 0.0066647, 0.0066647, 0.0066647 - 127, 0.032503, 0.030248, 0.0055057, 0.96337, 0.96553, 0.96908, 0.6688, 0.026015, 0.023054, 0.002129, 0.0066191, 0.0066191, 0.0066191 - 128, 0.031848, 0.030237, 0.0040163, 0.97874, 0.9667, 0.96928, 0.65926, 0.026758, 0.024459, 0.0019228, 0.0065734, 0.0065734, 0.0065734 - 129, 0.033826, 0.03026, 0.0075954, 0.97185, 0.97532, 0.97586, 0.65575, 0.027961, 0.023636, 0.0018942, 0.0065276, 0.0065276, 0.0065276 - 130, 0.034133, 0.029008, 0.0056355, 0.98736, 0.94112, 0.9718, 0.63606, 0.02707, 0.024257, 0.0019156, 0.0064816, 0.0064816, 0.0064816 - 131, 0.032031, 0.029106, 0.0046239, 0.97221, 0.91833, 0.96514, 0.62362, 0.027138, 0.024794, 0.0020008, 0.0064356, 0.0064356, 0.0064356 - 132, 0.031064, 0.028333, 0.005266, 0.90643, 0.90848, 0.94398, 0.52023, 0.032159, 0.02668, 0.0031502, 0.0063895, 0.0063895, 0.0063895 - 133, 0.031294, 0.030179, 0.0047473, 0.9751, 0.94523, 0.96989, 0.60873, 0.028775, 0.024644, 0.0019185, 0.0063432, 0.0063432, 0.0063432 - 134, 0.03095, 0.029861, 0.004757, 0.93719, 0.96354, 0.96023, 0.64725, 0.026088, 0.024737, 0.001847, 0.0062969, 0.0062969, 0.0062969 - 135, 0.030516, 0.028845, 0.0047947, 0.95301, 0.95197, 0.96786, 0.62838, 0.026574, 0.024545, 0.0017698, 0.0062505, 0.0062505, 0.0062505 - 136, 0.030475, 0.02846, 0.0055107, 0.96437, 0.9451, 0.96404, 0.64108, 0.027123, 0.024913, 0.0017149, 0.006204, 0.006204, 0.006204 - 137, 0.030362, 0.029429, 0.0048351, 0.97425, 0.96309, 0.96501, 0.6316, 0.027754, 0.025372, 0.0018266, 0.0061574, 0.0061574, 0.0061574 - 138, 0.030377, 0.030139, 0.0047596, 0.96266, 0.96512, 0.96441, 0.63686, 0.027537, 0.024936, 0.0019117, 0.0061107, 0.0061107, 0.0061107 - 139, 0.030934, 0.027383, 0.0046041, 0.97265, 0.9703, 0.96765, 0.64827, 0.027235, 0.024562, 0.0018573, 0.006064, 0.006064, 0.006064 - 140, 0.030503, 0.030103, 0.005123, 0.96566, 0.95537, 0.96187, 0.62706, 0.027453, 0.024727, 0.0018926, 0.0060172, 0.0060172, 0.0060172 - 141, 0.031252, 0.028443, 0.0041605, 0.97251, 0.96352, 0.96748, 0.66484, 0.026909, 0.024105, 0.0020043, 0.0059704, 0.0059704, 0.0059704 - 142, 0.029091, 0.029802, 0.004882, 0.98107, 0.97705, 0.97517, 0.6692, 0.025419, 0.023475, 0.0019698, 0.0059235, 0.0059235, 0.0059235 - 143, 0.029031, 0.027532, 0.0044102, 0.96415, 0.95001, 0.96306, 0.65746, 0.026583, 0.024414, 0.0018636, 0.0058766, 0.0058766, 0.0058766 - 144, 0.030322, 0.029805, 0.0045858, 0.95213, 0.97029, 0.96608, 0.66087, 0.02622, 0.024185, 0.0019045, 0.0058296, 0.0058296, 0.0058296 - 145, 0.03003, 0.027735, 0.0042047, 0.9629, 0.97049, 0.97254, 0.6706, 0.025957, 0.023952, 0.0019944, 0.0057826, 0.0057826, 0.0057826 - 146, 0.030178, 0.028212, 0.0038413, 0.97726, 0.96369, 0.96698, 0.6622, 0.025378, 0.025052, 0.0019726, 0.0057355, 0.0057355, 0.0057355 - 147, 0.0287, 0.027819, 0.0042913, 0.97216, 0.96354, 0.96631, 0.64059, 0.025874, 0.024205, 0.0019755, 0.0056884, 0.0056884, 0.0056884 - 148, 0.032043, 0.027684, 0.0048876, 0.98775, 0.95678, 0.96185, 0.61574, 0.029168, 0.025582, 0.001935, 0.0056413, 0.0056413, 0.0056413 - 149, 0.030177, 0.027118, 0.0045694, 0.98348, 0.95001, 0.96349, 0.66463, 0.026593, 0.023216, 0.0019195, 0.0055942, 0.0055942, 0.0055942 - 150, 0.028507, 0.030105, 0.0049029, 0.98161, 0.95661, 0.96846, 0.65684, 0.02566, 0.023492, 0.0021502, 0.0055471, 0.0055471, 0.0055471 - 151, 0.030499, 0.028858, 0.0074011, 0.98125, 0.9703, 0.97297, 0.68484, 0.026201, 0.022504, 0.002315, 0.0055, 0.0055, 0.0055 - 152, 0.02793, 0.028107, 0.0056783, 0.98268, 0.95669, 0.96742, 0.68158, 0.026543, 0.023369, 0.0024157, 0.0054529, 0.0054529, 0.0054529 - 153, 0.028745, 0.027211, 0.0047151, 0.98282, 0.95678, 0.96778, 0.67643, 0.024136, 0.022676, 0.0020738, 0.0054058, 0.0054058, 0.0054058 - 154, 0.02988, 0.028095, 0.0047024, 0.97564, 0.95678, 0.96446, 0.67542, 0.026337, 0.02249, 0.002291, 0.0053587, 0.0053587, 0.0053587 - 155, 0.028457, 0.029243, 0.0047708, 0.96159, 0.95678, 0.95796, 0.66082, 0.026913, 0.022992, 0.0021378, 0.0053116, 0.0053116, 0.0053116 - 156, 0.028992, 0.027253, 0.0048825, 0.97888, 0.96996, 0.9719, 0.6495, 0.027016, 0.022958, 0.001994, 0.0052645, 0.0052645, 0.0052645 - 157, 0.028998, 0.028506, 0.0044686, 0.95299, 0.97018, 0.96508, 0.6518, 0.026524, 0.022246, 0.0018938, 0.0052174, 0.0052174, 0.0052174 - 158, 0.029876, 0.028789, 0.0045456, 0.97905, 0.9703, 0.96656, 0.67184, 0.026013, 0.023414, 0.0020316, 0.0051704, 0.0051704, 0.0051704 - 159, 0.02783, 0.027954, 0.0047788, 0.95981, 0.9703, 0.97331, 0.65536, 0.026615, 0.023393, 0.0021369, 0.0051234, 0.0051234, 0.0051234 - 160, 0.02881, 0.029834, 0.0051372, 0.96231, 0.97705, 0.97276, 0.67234, 0.02516, 0.023334, 0.0020906, 0.0050765, 0.0050765, 0.0050765 - 161, 0.02907, 0.028024, 0.0050542, 0.97128, 0.97694, 0.97459, 0.67987, 0.024301, 0.022933, 0.0018993, 0.0050296, 0.0050296, 0.0050296 - 162, 0.027088, 0.02831, 0.0049067, 0.97555, 0.97705, 0.97511, 0.68172, 0.02416, 0.022443, 0.0016887, 0.0049828, 0.0049828, 0.0049828 - 163, 0.030222, 0.026841, 0.004733, 0.97753, 0.97705, 0.97482, 0.68213, 0.025884, 0.02258, 0.0016608, 0.004936, 0.004936, 0.004936 - 164, 0.028023, 0.028466, 0.0040835, 0.95802, 0.94365, 0.96412, 0.68017, 0.027131, 0.022298, 0.0018087, 0.0048893, 0.0048893, 0.0048893 - 165, 0.028881, 0.028552, 0.0037733, 0.98463, 0.9703, 0.966, 0.69216, 0.024287, 0.022506, 0.0017584, 0.0048426, 0.0048426, 0.0048426 - 166, 0.02887, 0.028066, 0.0051819, 0.97967, 0.97023, 0.96605, 0.67742, 0.023991, 0.022966, 0.0017765, 0.004796, 0.004796, 0.004796 - 167, 0.027769, 0.027876, 0.0045376, 0.97336, 0.9703, 0.96585, 0.67378, 0.024131, 0.022832, 0.0018437, 0.0047495, 0.0047495, 0.0047495 - 168, 0.026105, 0.026978, 0.0043823, 0.98068, 0.9703, 0.97141, 0.68531, 0.02506, 0.022971, 0.0019168, 0.0047031, 0.0047031, 0.0047031 - 169, 0.027398, 0.02762, 0.0039622, 0.98055, 0.96775, 0.96652, 0.69533, 0.023761, 0.022578, 0.0018546, 0.0046568, 0.0046568, 0.0046568 - 170, 0.028034, 0.027971, 0.0037273, 0.97684, 0.9703, 0.96783, 0.69053, 0.023457, 0.0223, 0.0017781, 0.0046105, 0.0046105, 0.0046105 - 171, 0.027347, 0.028535, 0.0038968, 0.97337, 0.96354, 0.96296, 0.67883, 0.024073, 0.022644, 0.001817, 0.0045644, 0.0045644, 0.0045644 - 172, 0.028142, 0.026267, 0.0034699, 0.98644, 0.96343, 0.96703, 0.69874, 0.02388, 0.02208, 0.0017773, 0.0045184, 0.0045184, 0.0045184 - 173, 0.026171, 0.027753, 0.0050813, 0.97569, 0.96352, 0.96478, 0.67178, 0.02579, 0.022882, 0.0018091, 0.0044724, 0.0044724, 0.0044724 - 174, 0.026128, 0.026436, 0.0053865, 0.97295, 0.96346, 0.96565, 0.67965, 0.025346, 0.023009, 0.001846, 0.0044266, 0.0044266, 0.0044266 - 175, 0.02726, 0.027188, 0.0035265, 0.97704, 0.96351, 0.96655, 0.68568, 0.024316, 0.022898, 0.0017214, 0.0043809, 0.0043809, 0.0043809 - 176, 0.026716, 0.026838, 0.0031932, 0.98022, 0.96354, 0.96597, 0.68301, 0.025983, 0.023226, 0.0016424, 0.0043353, 0.0043353, 0.0043353 - 177, 0.027251, 0.028037, 0.0054986, 0.97271, 0.96354, 0.96646, 0.68557, 0.026387, 0.022748, 0.0016146, 0.0042899, 0.0042899, 0.0042899 - 178, 0.026909, 0.026743, 0.0046035, 0.98252, 0.97027, 0.97551, 0.66755, 0.026705, 0.022883, 0.0016144, 0.0042445, 0.0042445, 0.0042445 - 179, 0.026095, 0.026161, 0.0058214, 0.98155, 0.97028, 0.96818, 0.66911, 0.025493, 0.023625, 0.0016812, 0.0041994, 0.0041994, 0.0041994 - 180, 0.024472, 0.026628, 0.0041876, 0.98266, 0.97705, 0.97576, 0.66959, 0.024833, 0.022997, 0.0017462, 0.0041543, 0.0041543, 0.0041543 - 181, 0.027072, 0.027344, 0.0044676, 0.98132, 0.97705, 0.9754, 0.68045, 0.024837, 0.022527, 0.0017458, 0.0041094, 0.0041094, 0.0041094 - 182, 0.028166, 0.02681, 0.0042947, 0.98137, 0.9703, 0.9683, 0.68976, 0.024242, 0.022963, 0.001793, 0.0040647, 0.0040647, 0.0040647 - 183, 0.026102, 0.027943, 0.0043331, 0.95813, 0.97705, 0.97464, 0.69977, 0.023437, 0.022746, 0.0018653, 0.0040201, 0.0040201, 0.0040201 - 184, 0.026373, 0.026178, 0.0037455, 0.98558, 0.96354, 0.97444, 0.69813, 0.024044, 0.022799, 0.0018616, 0.0039757, 0.0039757, 0.0039757 - 185, 0.028673, 0.026108, 0.0044021, 0.98181, 0.95199, 0.96343, 0.67845, 0.024732, 0.023188, 0.0018667, 0.0039314, 0.0039314, 0.0039314 - 186, 0.026675, 0.02758, 0.0041627, 0.98565, 0.96353, 0.96589, 0.68148, 0.022764, 0.022821, 0.001741, 0.0038873, 0.0038873, 0.0038873 - 187, 0.026643, 0.027148, 0.0038995, 0.98353, 0.97028, 0.96679, 0.68438, 0.02252, 0.022897, 0.0017302, 0.0038434, 0.0038434, 0.0038434 - 188, 0.027608, 0.027644, 0.0039359, 0.98275, 0.977, 0.97892, 0.69636, 0.023269, 0.022497, 0.0018708, 0.0037997, 0.0037997, 0.0037997 - 189, 0.024131, 0.027909, 0.0027875, 0.97406, 0.9703, 0.97597, 0.69888, 0.023948, 0.022371, 0.0023066, 0.0037562, 0.0037562, 0.0037562 - 190, 0.027156, 0.027026, 0.0036558, 0.98347, 0.96347, 0.9715, 0.68745, 0.023983, 0.023429, 0.0027685, 0.0037128, 0.0037128, 0.0037128 - 191, 0.027734, 0.026852, 0.0039689, 0.97298, 0.97025, 0.9738, 0.6853, 0.026086, 0.022382, 0.0022475, 0.0036697, 0.0036697, 0.0036697 - 192, 0.026927, 0.026752, 0.0037148, 0.96858, 0.96354, 0.96962, 0.69858, 0.023535, 0.022065, 0.0017252, 0.0036267, 0.0036267, 0.0036267 - 193, 0.027003, 0.027176, 0.0053776, 0.96122, 0.97705, 0.97883, 0.66762, 0.023695, 0.022581, 0.0018148, 0.003584, 0.003584, 0.003584 - 194, 0.026989, 0.027615, 0.006495, 0.95862, 0.95678, 0.96378, 0.61374, 0.02806, 0.024838, 0.0017687, 0.0035415, 0.0035415, 0.0035415 - 195, 0.027666, 0.026871, 0.0057181, 0.96489, 0.9702, 0.96448, 0.66116, 0.024083, 0.024089, 0.0018062, 0.0034991, 0.0034991, 0.0034991 - 196, 0.026176, 0.02691, 0.004667, 0.97361, 0.96348, 0.96482, 0.67681, 0.024865, 0.023765, 0.0019973, 0.003457, 0.003457, 0.003457 - 197, 0.026469, 0.027627, 0.0049022, 0.96453, 0.96354, 0.97173, 0.68511, 0.024681, 0.022624, 0.0021242, 0.0034152, 0.0034152, 0.0034152 - 198, 0.027208, 0.028003, 0.0049884, 0.97647, 0.96354, 0.96577, 0.69568, 0.024119, 0.022065, 0.0021831, 0.0033735, 0.0033735, 0.0033735 - 199, 0.025903, 0.027341, 0.0048099, 0.98137, 0.95876, 0.96996, 0.69246, 0.024701, 0.022356, 0.0023582, 0.0033321, 0.0033321, 0.0033321 - 200, 0.026184, 0.027374, 0.0042712, 0.98338, 0.9635, 0.96994, 0.67492, 0.025071, 0.022943, 0.0024592, 0.0032909, 0.0032909, 0.0032909 - 201, 0.026189, 0.025554, 0.0040891, 0.98737, 0.94994, 0.96182, 0.66253, 0.025125, 0.023302, 0.0023766, 0.00325, 0.00325, 0.00325 - 202, 0.024545, 0.026731, 0.0041204, 0.9815, 0.9703, 0.97592, 0.68519, 0.024929, 0.022513, 0.0020454, 0.0032093, 0.0032093, 0.0032093 - 203, 0.02617, 0.025825, 0.0042871, 0.95509, 0.97705, 0.97726, 0.68377, 0.024432, 0.022358, 0.0020345, 0.0031689, 0.0031689, 0.0031689 - 204, 0.023137, 0.024813, 0.0036278, 0.96776, 0.96354, 0.97128, 0.69433, 0.026057, 0.022551, 0.0019471, 0.0031287, 0.0031287, 0.0031287 - 205, 0.025338, 0.025502, 0.0037127, 0.99338, 0.95089, 0.96514, 0.68198, 0.025945, 0.023259, 0.0021286, 0.0030888, 0.0030888, 0.0030888 - 206, 0.026339, 0.02602, 0.0039489, 0.98518, 0.97028, 0.96743, 0.67505, 0.023719, 0.022723, 0.0020737, 0.0030491, 0.0030491, 0.0030491 - 207, 0.026491, 0.027071, 0.0040128, 0.98605, 0.96354, 0.96766, 0.68313, 0.024904, 0.022284, 0.0022663, 0.0030097, 0.0030097, 0.0030097 - 208, 0.025094, 0.025137, 0.0043872, 0.99331, 0.9505, 0.96795, 0.6957, 0.024963, 0.021901, 0.0026323, 0.0029706, 0.0029706, 0.0029706 - 209, 0.026184, 0.027171, 0.0039022, 0.9868, 0.95678, 0.96685, 0.69064, 0.026298, 0.022596, 0.0027955, 0.0029318, 0.0029318, 0.0029318 - 210, 0.025956, 0.025668, 0.0049788, 0.97688, 0.95678, 0.97237, 0.69002, 0.025732, 0.022511, 0.0025778, 0.0028932, 0.0028932, 0.0028932 - 211, 0.027297, 0.025791, 0.0040839, 0.98462, 0.9703, 0.96931, 0.6969, 0.026088, 0.0223, 0.0022371, 0.002855, 0.002855, 0.002855 - 212, 0.02525, 0.026303, 0.0047559, 0.9774, 0.96349, 0.96719, 0.69013, 0.025161, 0.022704, 0.0021132, 0.002817, 0.002817, 0.002817 - 213, 0.024295, 0.026973, 0.0041341, 0.97281, 0.97705, 0.9826, 0.68997, 0.024569, 0.022605, 0.0019869, 0.0027793, 0.0027793, 0.0027793 - 214, 0.024136, 0.025274, 0.0038694, 0.97589, 0.94326, 0.97578, 0.68725, 0.02548, 0.022043, 0.0018324, 0.0027419, 0.0027419, 0.0027419 - 215, 0.025528, 0.027067, 0.0040959, 0.96603, 0.9567, 0.96499, 0.68876, 0.024627, 0.022841, 0.0020294, 0.0027048, 0.0027048, 0.0027048 - 216, 0.025221, 0.027184, 0.0047706, 0.95868, 0.96353, 0.96453, 0.6809, 0.025527, 0.022776, 0.0021757, 0.0026681, 0.0026681, 0.0026681 - 217, 0.024044, 0.024836, 0.0042798, 0.98084, 0.95673, 0.96482, 0.68198, 0.025761, 0.022618, 0.002021, 0.0026316, 0.0026316, 0.0026316 - 218, 0.025253, 0.027373, 0.0041113, 0.96325, 0.9689, 0.97805, 0.69718, 0.025244, 0.021851, 0.0018038, 0.0025954, 0.0025954, 0.0025954 - 219, 0.025786, 0.024412, 0.0038547, 0.9784, 0.96354, 0.97334, 0.67628, 0.024993, 0.022038, 0.001677, 0.0025596, 0.0025596, 0.0025596 - 220, 0.024866, 0.025262, 0.0039628, 0.97738, 0.96354, 0.97295, 0.67586, 0.025099, 0.02182, 0.0016662, 0.0025241, 0.0025241, 0.0025241 - 221, 0.025464, 0.027381, 0.0037889, 0.95635, 0.97015, 0.96925, 0.70037, 0.024523, 0.021997, 0.0017885, 0.0024889, 0.0024889, 0.0024889 - 222, 0.024976, 0.025851, 0.0034427, 0.95665, 0.96354, 0.96272, 0.70145, 0.024242, 0.021824, 0.0018279, 0.0024541, 0.0024541, 0.0024541 - 223, 0.024802, 0.02694, 0.0031541, 0.95601, 0.96294, 0.9618, 0.68561, 0.024934, 0.022417, 0.0018971, 0.0024195, 0.0024195, 0.0024195 - 224, 0.024682, 0.026038, 0.0032441, 0.97713, 0.96354, 0.97524, 0.68246, 0.026721, 0.022906, 0.0020948, 0.0023854, 0.0023854, 0.0023854 - 225, 0.025083, 0.026697, 0.0037998, 0.96721, 0.9703, 0.97428, 0.68679, 0.02599, 0.022761, 0.0020577, 0.0023515, 0.0023515, 0.0023515 - 226, 0.024088, 0.025932, 0.0035885, 0.96876, 0.97703, 0.97508, 0.68276, 0.024445, 0.022962, 0.0019322, 0.002318, 0.002318, 0.002318 - 227, 0.023332, 0.025505, 0.0037625, 0.96578, 0.97705, 0.97358, 0.68462, 0.024101, 0.02255, 0.0018148, 0.0022849, 0.0022849, 0.0022849 - 228, 0.024702, 0.024819, 0.0034758, 0.97385, 0.97028, 0.97462, 0.69212, 0.024558, 0.022178, 0.0017297, 0.0022521, 0.0022521, 0.0022521 - 229, 0.024602, 0.025566, 0.0038347, 0.96628, 0.96353, 0.96616, 0.70351, 0.023898, 0.022227, 0.0016842, 0.0022196, 0.0022196, 0.0022196 - 230, 0.023372, 0.025582, 0.0035108, 0.98707, 0.9567, 0.96796, 0.6879, 0.024704, 0.022368, 0.0017089, 0.0021876, 0.0021876, 0.0021876 - 231, 0.024074, 0.025893, 0.0031354, 0.98694, 0.95678, 0.9676, 0.68024, 0.024659, 0.023358, 0.0017729, 0.0021558, 0.0021558, 0.0021558 - 232, 0.024966, 0.027324, 0.0032754, 0.9826, 0.95678, 0.9736, 0.70037, 0.02362, 0.022499, 0.001837, 0.0021245, 0.0021245, 0.0021245 - 233, 0.025124, 0.026055, 0.0039871, 0.9706, 0.96971, 0.97903, 0.70731, 0.0229, 0.021873, 0.0017568, 0.0020935, 0.0020935, 0.0020935 - 234, 0.022206, 0.02586, 0.0033446, 0.9787, 0.95003, 0.96954, 0.70051, 0.023775, 0.022511, 0.0017292, 0.0020629, 0.0020629, 0.0020629 - 235, 0.024355, 0.023389, 0.0040127, 0.98374, 0.9703, 0.96776, 0.68733, 0.022898, 0.022383, 0.0017637, 0.0020327, 0.0020327, 0.0020327 - 236, 0.024096, 0.026566, 0.0032116, 0.98492, 0.96354, 0.97267, 0.70113, 0.021918, 0.022037, 0.0017403, 0.0020028, 0.0020028, 0.0020028 - 237, 0.024077, 0.025841, 0.0032894, 0.97582, 0.96353, 0.967, 0.69301, 0.021952, 0.02197, 0.0017976, 0.0019734, 0.0019734, 0.0019734 - 238, 0.024347, 0.025564, 0.0039452, 0.97899, 0.96354, 0.96707, 0.69185, 0.022981, 0.022335, 0.0018357, 0.0019443, 0.0019443, 0.0019443 - 239, 0.023853, 0.024579, 0.0044756, 0.97532, 0.95678, 0.96534, 0.69215, 0.023931, 0.022646, 0.0018563, 0.0019156, 0.0019156, 0.0019156 - 240, 0.023002, 0.025647, 0.0035852, 0.97411, 0.96353, 0.97209, 0.69136, 0.023933, 0.022786, 0.0019303, 0.0018873, 0.0018873, 0.0018873 - 241, 0.023632, 0.025356, 0.0034878, 0.96367, 0.97026, 0.98007, 0.70663, 0.023831, 0.022384, 0.0019032, 0.0018594, 0.0018594, 0.0018594 - 242, 0.023527, 0.025798, 0.0036633, 0.97056, 0.96832, 0.97529, 0.70001, 0.024231, 0.022414, 0.001796, 0.0018319, 0.0018319, 0.0018319 - 243, 0.022682, 0.025564, 0.003487, 0.97515, 0.96351, 0.9668, 0.69187, 0.024127, 0.022944, 0.0017143, 0.0018048, 0.0018048, 0.0018048 - 244, 0.024222, 0.026106, 0.0035024, 0.97655, 0.95675, 0.96682, 0.69463, 0.023624, 0.022958, 0.0016919, 0.0017781, 0.0017781, 0.0017781 - 245, 0.02326, 0.025099, 0.0029967, 0.96808, 0.97681, 0.97562, 0.70458, 0.023273, 0.02276, 0.0016949, 0.0017519, 0.0017519, 0.0017519 - 246, 0.024062, 0.024739, 0.0040586, 0.96483, 0.9635, 0.97182, 0.69647, 0.023717, 0.022898, 0.0017371, 0.001726, 0.001726, 0.001726 - 247, 0.023201, 0.0253, 0.0032933, 0.97972, 0.95633, 0.97253, 0.69153, 0.024038, 0.022889, 0.0017084, 0.0017005, 0.0017005, 0.0017005 - 248, 0.024654, 0.026136, 0.0033753, 0.98866, 0.95667, 0.97459, 0.68796, 0.023902, 0.022352, 0.0017804, 0.0016755, 0.0016755, 0.0016755 - 249, 0.023838, 0.025222, 0.0033712, 0.96588, 0.9703, 0.97386, 0.69894, 0.023947, 0.022392, 0.0018015, 0.0016509, 0.0016509, 0.0016509 - 250, 0.023668, 0.024787, 0.0034169, 0.98732, 0.95003, 0.96765, 0.69254, 0.023956, 0.022749, 0.0017763, 0.0016267, 0.0016267, 0.0016267 - 251, 0.022859, 0.025103, 0.003568, 0.95814, 0.97702, 0.9737, 0.70092, 0.023604, 0.022479, 0.0017848, 0.0016029, 0.0016029, 0.0016029 - 252, 0.022666, 0.024463, 0.0032009, 0.98704, 0.97027, 0.97466, 0.69009, 0.023513, 0.022304, 0.0017728, 0.0015795, 0.0015795, 0.0015795 - 253, 0.023492, 0.026417, 0.0028279, 0.96436, 0.98372, 0.98019, 0.69935, 0.023358, 0.021836, 0.00174, 0.0015566, 0.0015566, 0.0015566 - 254, 0.024491, 0.025485, 0.002979, 0.9853, 0.95678, 0.96646, 0.69592, 0.023924, 0.022304, 0.0018352, 0.0015341, 0.0015341, 0.0015341 - 255, 0.02484, 0.025362, 0.0035361, 0.96452, 0.96353, 0.9651, 0.69518, 0.024445, 0.022635, 0.0018837, 0.0015121, 0.0015121, 0.0015121 - 256, 0.023908, 0.025521, 0.0036297, 0.96519, 0.96354, 0.96511, 0.6864, 0.024269, 0.022565, 0.0018298, 0.0014905, 0.0014905, 0.0014905 - 257, 0.02373, 0.025435, 0.0035398, 0.97944, 0.97703, 0.98018, 0.69367, 0.023299, 0.022476, 0.001668, 0.0014693, 0.0014693, 0.0014693 - 258, 0.023375, 0.025846, 0.0030582, 0.98528, 0.97531, 0.97812, 0.69421, 0.023276, 0.022128, 0.0015514, 0.0014486, 0.0014486, 0.0014486 - 259, 0.021545, 0.024249, 0.0026146, 0.97663, 0.97029, 0.97653, 0.71099, 0.023939, 0.022179, 0.0015795, 0.0014283, 0.0014283, 0.0014283 - 260, 0.022169, 0.025532, 0.0040977, 0.97732, 0.9703, 0.97464, 0.68688, 0.024342, 0.022362, 0.001622, 0.0014084, 0.0014084, 0.0014084 - 261, 0.022755, 0.024997, 0.0032319, 0.97619, 0.9703, 0.97406, 0.70667, 0.024472, 0.021516, 0.0016024, 0.001389, 0.001389, 0.001389 - 262, 0.023288, 0.02633, 0.0034072, 0.97402, 0.97705, 0.97597, 0.70608, 0.023844, 0.021676, 0.0016408, 0.0013701, 0.0013701, 0.0013701 - 263, 0.02379, 0.025776, 0.0036441, 0.97543, 0.98358, 0.98268, 0.70729, 0.024337, 0.022026, 0.0016763, 0.0013516, 0.0013516, 0.0013516 - 264, 0.02391, 0.024676, 0.0036971, 0.97962, 0.97023, 0.98219, 0.72072, 0.024265, 0.021404, 0.0017216, 0.0013336, 0.0013336, 0.0013336 - 265, 0.02313, 0.024861, 0.0031131, 0.97831, 0.97705, 0.9824, 0.71233, 0.023289, 0.021431, 0.001778, 0.001316, 0.001316, 0.001316 - 266, 0.022911, 0.023178, 0.0040326, 0.9855, 0.95678, 0.97393, 0.70797, 0.023489, 0.021917, 0.001843, 0.0012989, 0.0012989, 0.0012989 - 267, 0.022923, 0.025628, 0.0032744, 0.98466, 0.95676, 0.97389, 0.70614, 0.023732, 0.021756, 0.0018387, 0.0012822, 0.0012822, 0.0012822 - 268, 0.021734, 0.024794, 0.0037717, 0.97172, 0.9703, 0.9748, 0.69889, 0.023854, 0.021882, 0.0018406, 0.001266, 0.001266, 0.001266 - 269, 0.023233, 0.023997, 0.0026434, 0.98878, 0.95002, 0.97413, 0.69813, 0.024157, 0.022212, 0.0018839, 0.0012503, 0.0012503, 0.0012503 - 270, 0.022645, 0.024259, 0.0028535, 0.9733, 0.9703, 0.97535, 0.70777, 0.024298, 0.021893, 0.001847, 0.001235, 0.001235, 0.001235 - 271, 0.022842, 0.025684, 0.003931, 0.97335, 0.9703, 0.97546, 0.6987, 0.023966, 0.022058, 0.0018554, 0.0012202, 0.0012202, 0.0012202 - 272, 0.022658, 0.02243, 0.0029644, 0.98127, 0.97703, 0.97619, 0.70566, 0.024319, 0.022133, 0.0018315, 0.0012059, 0.0012059, 0.0012059 - 273, 0.021985, 0.023866, 0.003224, 0.97334, 0.97028, 0.97532, 0.71404, 0.02463, 0.021925, 0.0017855, 0.0011921, 0.0011921, 0.0011921 - 274, 0.021942, 0.025971, 0.0030934, 0.9921, 0.94045, 0.96804, 0.70548, 0.023867, 0.02181, 0.0017593, 0.0011787, 0.0011787, 0.0011787 - 275, 0.022654, 0.025224, 0.002868, 0.97576, 0.96344, 0.98036, 0.71113, 0.023825, 0.021833, 0.001792, 0.0011658, 0.0011658, 0.0011658 - 276, 0.022061, 0.023995, 0.0044932, 0.96396, 0.97519, 0.98094, 0.70244, 0.025151, 0.022106, 0.0018909, 0.0011533, 0.0011533, 0.0011533 - 277, 0.022082, 0.024009, 0.0043146, 0.9688, 0.96354, 0.96678, 0.69519, 0.025253, 0.022238, 0.0019813, 0.0011414, 0.0011414, 0.0011414 - 278, 0.022718, 0.025438, 0.0033991, 0.98149, 0.97029, 0.96863, 0.69842, 0.024404, 0.021862, 0.0021195, 0.0011299, 0.0011299, 0.0011299 - 279, 0.021459, 0.024987, 0.0033223, 0.98556, 0.96354, 0.97556, 0.70391, 0.024428, 0.021777, 0.002116, 0.0011189, 0.0011189, 0.0011189 - 280, 0.022531, 0.025328, 0.0029854, 0.97082, 0.97026, 0.98069, 0.70413, 0.024501, 0.021852, 0.0020207, 0.0011084, 0.0011084, 0.0011084 - 281, 0.021432, 0.02498, 0.0037385, 0.97039, 0.9703, 0.98025, 0.70643, 0.024077, 0.021808, 0.0018792, 0.0010983, 0.0010983, 0.0010983 - 282, 0.022082, 0.024033, 0.0035464, 0.97989, 0.97705, 0.98222, 0.70106, 0.023699, 0.021782, 0.0018304, 0.0010888, 0.0010888, 0.0010888 - 283, 0.022438, 0.026502, 0.0037712, 0.97219, 0.97702, 0.9805, 0.70248, 0.023944, 0.022022, 0.0018007, 0.0010797, 0.0010797, 0.0010797 - 284, 0.021952, 0.026204, 0.0030446, 0.9716, 0.977, 0.9802, 0.71073, 0.024671, 0.022283, 0.0017623, 0.0010711, 0.0010711, 0.0010711 - 285, 0.02244, 0.024696, 0.0031012, 0.97361, 0.9703, 0.98002, 0.71442, 0.024199, 0.022152, 0.0017836, 0.001063, 0.001063, 0.001063 - 286, 0.021664, 0.023039, 0.0027769, 0.97304, 0.96354, 0.97902, 0.70917, 0.023735, 0.022079, 0.0017841, 0.0010554, 0.0010554, 0.0010554 - 287, 0.022677, 0.025335, 0.0041636, 0.97759, 0.97705, 0.98093, 0.71153, 0.022869, 0.022005, 0.0017778, 0.0010483, 0.0010483, 0.0010483 - 288, 0.022281, 0.025492, 0.0036219, 0.98065, 0.97025, 0.98087, 0.70983, 0.022568, 0.022306, 0.0018028, 0.0010416, 0.0010416, 0.0010416 - 289, 0.023508, 0.024725, 0.0040105, 0.97198, 0.97023, 0.98068, 0.70539, 0.023018, 0.022493, 0.001852, 0.0010355, 0.0010355, 0.0010355 - 290, 0.023213, 0.024867, 0.0040221, 0.97374, 0.9703, 0.98036, 0.70964, 0.023247, 0.022265, 0.0018443, 0.0010298, 0.0010298, 0.0010298 - 291, 0.021429, 0.023571, 0.0036408, 0.97524, 0.96354, 0.97319, 0.7067, 0.023258, 0.022189, 0.0018254, 0.0010247, 0.0010247, 0.0010247 - 292, 0.021587, 0.024857, 0.0031796, 0.97449, 0.9703, 0.98051, 0.71474, 0.02327, 0.022178, 0.0018069, 0.00102, 0.00102, 0.00102 - 293, 0.022102, 0.02446, 0.0038188, 0.9726, 0.9703, 0.98018, 0.71203, 0.023105, 0.022171, 0.0017905, 0.0010158, 0.0010158, 0.0010158 - 294, 0.021959, 0.024979, 0.0029226, 0.98156, 0.9703, 0.97487, 0.70595, 0.022793, 0.022188, 0.0018304, 0.0010121, 0.0010121, 0.0010121 - 295, 0.021182, 0.025238, 0.0033527, 0.96627, 0.9703, 0.97301, 0.71552, 0.023089, 0.021885, 0.0018715, 0.0010089, 0.0010089, 0.0010089 - 296, 0.022339, 0.024582, 0.0034718, 0.96882, 0.97705, 0.98079, 0.719, 0.023042, 0.021523, 0.0018468, 0.0010062, 0.0010062, 0.0010062 - 297, 0.022934, 0.025444, 0.0036708, 0.97071, 0.97619, 0.9806, 0.72045, 0.023387, 0.021511, 0.0017952, 0.0010039, 0.0010039, 0.0010039 - 298, 0.022714, 0.024515, 0.004176, 0.97351, 0.97029, 0.98062, 0.71732, 0.023228, 0.021938, 0.0018586, 0.0010022, 0.0010022, 0.0010022 - 299, 0.022972, 0.026098, 0.0036222, 0.98, 0.97705, 0.98277, 0.70426, 0.023559, 0.022199, 0.0019408, 0.001001, 0.001001, 0.001001 diff --git a/ros2_ws/src/yolov3/runs/train/exp15/results.png b/ros2_ws/src/yolov3/runs/train/exp15/results.png deleted file mode 100644 index 9e9edcac..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/results.png and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/train_batch0.jpg b/ros2_ws/src/yolov3/runs/train/exp15/train_batch0.jpg deleted file mode 100644 index 16a0f778..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/train_batch0.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/train_batch1.jpg b/ros2_ws/src/yolov3/runs/train/exp15/train_batch1.jpg deleted file mode 100644 index 2f7cdf28..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/train_batch1.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/train_batch2.jpg b/ros2_ws/src/yolov3/runs/train/exp15/train_batch2.jpg deleted file mode 100644 index 8160a8e2..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/train_batch2.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_labels.jpg b/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_labels.jpg deleted file mode 100644 index c6c6bf96..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_labels.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_pred.jpg b/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_pred.jpg deleted file mode 100644 index 7885c9d7..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/val_batch0_pred.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_labels.jpg b/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_labels.jpg deleted file mode 100644 index ebbff892..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_labels.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_pred.jpg b/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_pred.jpg deleted file mode 100644 index 3739349a..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/val_batch1_pred.jpg and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/weights/best.pt b/ros2_ws/src/yolov3/runs/train/exp15/weights/best.pt deleted file mode 100644 index 75ed15f3..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/weights/best.pt and /dev/null differ diff --git a/ros2_ws/src/yolov3/runs/train/exp15/weights/last.pt b/ros2_ws/src/yolov3/runs/train/exp15/weights/last.pt deleted file mode 100644 index 65ed1364..00000000 Binary files a/ros2_ws/src/yolov3/runs/train/exp15/weights/last.pt and /dev/null differ diff --git a/ros2_ws/src/yolov3/utils/loggers/comet/optimizer_config.json b/ros2_ws/src/yolov3/utils/loggers/comet/optimizer_config.json deleted file mode 100644 index 83ddddab..00000000 --- a/ros2_ws/src/yolov3/utils/loggers/comet/optimizer_config.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "algorithm": "random", - "parameters": { - "anchor_t": { - "type": "discrete", - "values": [ - 2, - 8 - ] - }, - "batch_size": { - "type": "discrete", - "values": [ - 16, - 32, - 64 - ] - }, - "box": { - "type": "discrete", - "values": [ - 0.02, - 0.2 - ] - }, - "cls": { - "type": "discrete", - "values": [ - 0.2 - ] - }, - "cls_pw": { - "type": "discrete", - "values": [ - 0.5 - ] - }, - "copy_paste": { - "type": "discrete", - "values": [ - 1 - ] - }, - "degrees": { - "type": "discrete", - "values": [ - 0, - 45 - ] - }, - "epochs": { - "type": "discrete", - "values": [ - 5 - ] - }, - "fl_gamma": { - "type": "discrete", - "values": [ - 0 - ] - }, - "fliplr": { - "type": "discrete", - "values": [ - 0 - ] - }, - "flipud": { - "type": "discrete", - "values": [ - 0 - ] - }, - "hsv_h": { - "type": "discrete", - "values": [ - 0 - ] - }, - "hsv_s": { - "type": "discrete", - "values": [ - 0 - ] - }, - "hsv_v": { - "type": "discrete", - "values": [ - 0 - ] - }, - "iou_t": { - "type": "discrete", - "values": [ - 0.7 - ] - }, - "lr0": { - "type": "discrete", - "values": [ - 1e-05, - 0.1 - ] - }, - "lrf": { - "type": "discrete", - "values": [ - 0.01, - 1 - ] - }, - "mixup": { - "type": "discrete", - "values": [ - 1 - ] - }, - "momentum": { - "type": "discrete", - "values": [ - 0.6 - ] - }, - "mosaic": { - "type": "discrete", - "values": [ - 0 - ] - }, - "obj": { - "type": "discrete", - "values": [ - 0.2 - ] - }, - "obj_pw": { - "type": "discrete", - "values": [ - 0.5 - ] - }, - "optimizer": { - "type": "categorical", - "values": [ - "SGD", - "Adam", - "AdamW" - ] - }, - "perspective": { - "type": "discrete", - "values": [ - 0 - ] - }, - "scale": { - "type": "discrete", - "values": [ - 0 - ] - }, - "shear": { - "type": "discrete", - "values": [ - 0 - ] - }, - "translate": { - "type": "discrete", - "values": [ - 0 - ] - }, - "warmup_bias_lr": { - "type": "discrete", - "values": [ - 0, - 0.2 - ] - }, - "warmup_epochs": { - "type": "discrete", - "values": [ - 5 - ] - }, - "warmup_momentum": { - "type": "discrete", - "values": [ - 0, - 0.95 - ] - }, - "weight_decay": { - "type": "discrete", - "values": [ - 0, - 0.001 - ] - } - }, - "spec": { - "maxCombo": 0, - "metric": "metrics/mAP_0.5", - "objective": "maximize" - }, - "trials": 1 -} diff --git a/ros2_ws/src/yolov3/.dockerignore b/yolov3/.dockerignore similarity index 100% rename from ros2_ws/src/yolov3/.dockerignore rename to yolov3/.dockerignore diff --git a/ros2_ws/src/yolov3/.gitattributes b/yolov3/.gitattributes similarity index 100% rename from ros2_ws/src/yolov3/.gitattributes rename to yolov3/.gitattributes diff --git a/ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/bug-report.yml b/yolov3/.github/ISSUE_TEMPLATE/bug-report.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/bug-report.yml rename to yolov3/.github/ISSUE_TEMPLATE/bug-report.yml diff --git a/ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/config.yml b/yolov3/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/config.yml rename to yolov3/.github/ISSUE_TEMPLATE/config.yml diff --git a/ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/feature-request.yml b/yolov3/.github/ISSUE_TEMPLATE/feature-request.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/feature-request.yml rename to yolov3/.github/ISSUE_TEMPLATE/feature-request.yml diff --git a/ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/question.yml b/yolov3/.github/ISSUE_TEMPLATE/question.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/ISSUE_TEMPLATE/question.yml rename to yolov3/.github/ISSUE_TEMPLATE/question.yml diff --git a/ros2_ws/src/yolov3/.github/PULL_REQUEST_TEMPLATE.md b/yolov3/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from ros2_ws/src/yolov3/.github/PULL_REQUEST_TEMPLATE.md rename to yolov3/.github/PULL_REQUEST_TEMPLATE.md diff --git a/ros2_ws/src/yolov3/.github/dependabot.yml b/yolov3/.github/dependabot.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/dependabot.yml rename to yolov3/.github/dependabot.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/ci-testing.yml b/yolov3/.github/workflows/ci-testing.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/ci-testing.yml rename to yolov3/.github/workflows/ci-testing.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/codeql-analysis.yml b/yolov3/.github/workflows/codeql-analysis.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/codeql-analysis.yml rename to yolov3/.github/workflows/codeql-analysis.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/docker.yml b/yolov3/.github/workflows/docker.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/docker.yml rename to yolov3/.github/workflows/docker.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/greetings.yml b/yolov3/.github/workflows/greetings.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/greetings.yml rename to yolov3/.github/workflows/greetings.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/stale.yml b/yolov3/.github/workflows/stale.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/stale.yml rename to yolov3/.github/workflows/stale.yml diff --git a/ros2_ws/src/yolov3/.github/workflows/translate-readme.yml b/yolov3/.github/workflows/translate-readme.yml similarity index 100% rename from ros2_ws/src/yolov3/.github/workflows/translate-readme.yml rename to yolov3/.github/workflows/translate-readme.yml diff --git a/ros2_ws/src/yolov3/.gitignore b/yolov3/.gitignore similarity index 100% rename from ros2_ws/src/yolov3/.gitignore rename to yolov3/.gitignore diff --git a/ros2_ws/src/yolov3/.pre-commit-config.yaml b/yolov3/.pre-commit-config.yaml similarity index 100% rename from ros2_ws/src/yolov3/.pre-commit-config.yaml rename to yolov3/.pre-commit-config.yaml diff --git a/ros2_ws/src/yolov3/CITATION.cff b/yolov3/CITATION.cff similarity index 100% rename from ros2_ws/src/yolov3/CITATION.cff rename to yolov3/CITATION.cff diff --git a/ros2_ws/src/yolov3/CMakeLists.txt b/yolov3/CMakeLists.txt similarity index 100% rename from ros2_ws/src/yolov3/CMakeLists.txt rename to yolov3/CMakeLists.txt diff --git a/ros2_ws/src/yolov3/CONTRIBUTING.md b/yolov3/CONTRIBUTING.md similarity index 100% rename from ros2_ws/src/yolov3/CONTRIBUTING.md rename to yolov3/CONTRIBUTING.md diff --git a/yolov3/Dockerfile b/yolov3/Dockerfile new file mode 100644 index 00000000..12842422 --- /dev/null +++ b/yolov3/Dockerfile @@ -0,0 +1,61 @@ +# YOLOv3 🚀 by Ultralytics, GPL-3.0 license + +# Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch +FROM nvcr.io/nvidia/pytorch:21.10-py3 + +# Install linux packages +RUN apt update && apt install -y zip htop screen libgl1-mesa-glx + +# Install python dependencies +COPY requirements.txt . +RUN python -m pip install --upgrade pip +RUN pip uninstall -y nvidia-tensorboard nvidia-tensorboard-plugin-dlprof +RUN pip install --no-cache -r requirements.txt coremltools onnx gsutil notebook wandb>=0.12.2 +RUN pip install --no-cache -U torch torchvision numpy Pillow +# RUN pip install --no-cache torch==1.10.0+cu113 torchvision==0.11.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html + +# Create working directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Copy contents +COPY . /usr/src/app + +# Downloads to user config dir +ADD https://ultralytics.com/assets/Arial.ttf /root/.config/Ultralytics/ + +# Set environment variables +# ENV HOME=/usr/src/app + + +# Usage Examples ------------------------------------------------------------------------------------------------------- + +# Build and Push +# t=ultralytics/yolov3:latest && sudo docker build -t $t . && sudo docker push $t + +# Pull and Run +# t=ultralytics/yolov3:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t + +# Pull and Run with local directory access +# t=ultralytics/yolov3:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/datasets:/usr/src/datasets $t + +# Kill all +# sudo docker kill $(sudo docker ps -q) + +# Kill all image-based +# sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/yolov3:latest) + +# Bash into running container +# sudo docker exec -it 5a9b5863d93d bash + +# Bash into stopped container +# id=$(sudo docker ps -qa) && sudo docker start $id && sudo docker exec -it $id bash + +# Clean up +# docker system prune -a --volumes + +# Update Ubuntu drivers +# https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/ + +# DDP test +# python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3 diff --git a/ros2_ws/src/yolov3/LICENSE b/yolov3/LICENSE similarity index 100% rename from ros2_ws/src/yolov3/LICENSE rename to yolov3/LICENSE diff --git a/ros2_ws/src/yolov3/README.md b/yolov3/README.md similarity index 100% rename from ros2_ws/src/yolov3/README.md rename to yolov3/README.md diff --git a/ros2_ws/src/yolov3/README.zh-CN.md b/yolov3/README.zh-CN.md similarity index 100% rename from ros2_ws/src/yolov3/README.zh-CN.md rename to yolov3/README.zh-CN.md diff --git a/ros2_ws/src/yolov3/benchmarks.py b/yolov3/benchmarks.py similarity index 100% rename from ros2_ws/src/yolov3/benchmarks.py rename to yolov3/benchmarks.py diff --git a/ros2_ws/src/yolov3/classify/predict.py b/yolov3/classify/predict.py similarity index 100% rename from ros2_ws/src/yolov3/classify/predict.py rename to yolov3/classify/predict.py diff --git a/ros2_ws/src/yolov3/classify/train.py b/yolov3/classify/train.py similarity index 100% rename from ros2_ws/src/yolov3/classify/train.py rename to yolov3/classify/train.py diff --git a/ros2_ws/src/yolov3/classify/tutorial.ipynb b/yolov3/classify/tutorial.ipynb similarity index 100% rename from ros2_ws/src/yolov3/classify/tutorial.ipynb rename to yolov3/classify/tutorial.ipynb diff --git a/ros2_ws/src/yolov3/classify/val.py b/yolov3/classify/val.py similarity index 100% rename from ros2_ws/src/yolov3/classify/val.py rename to yolov3/classify/val.py diff --git a/yolov3/convert_pt_to_weight.py b/yolov3/convert_pt_to_weight.py new file mode 100644 index 00000000..265d4992 --- /dev/null +++ b/yolov3/convert_pt_to_weight.py @@ -0,0 +1,33 @@ +import torch +from models.yolo import * + +# Define the YOLOv3 model +# model = YOLO(num_classes=80) +model = Model('models/yolov3.yaml') + +# Load the PyTorch .pt file +model.load_state_dict(torch.load('/home/parallels/ros2_ws/src/darknet_ros_fp16/darknet_ros/darknet_ros/yolo_network_config/weights/pipe_yolo3.pt')) + +# Create a dictionary of layer names and weights +layer_weights = {} +for name, param in model.named_parameters(): + if name.endswith('.bias'): + continue + layer_name = name.rsplit('.', 1)[0] + if layer_name not in layer_weights: + layer_weights[layer_name] = [] + layer_weights[layer_name].append(param.detach().cpu().numpy()) + +# Write the weights to a binary file in Darknet's .weights format +with open('yolov3_pipe.weights', 'wb') as f: + for layer_name, weights in layer_weights.items(): + header = [0, 0, 0, 0] + header[0] = weights[0].shape[0] # Number of filters + header[1] = weights[0].shape[1] # Number of channels + header[2] = weights[0].shape[2] # Filter height + header[3] = weights[0].shape[3] # Filter width + f.write(bytes(header)) + + for w in weights: + w = w.flatten() + f.write(w.tobytes()) diff --git a/ros2_ws/src/yolov3/data/Argoverse.yaml b/yolov3/data/Argoverse.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/Argoverse.yaml rename to yolov3/data/Argoverse.yaml diff --git a/ros2_ws/src/yolov3/data/GlobalWheat2020.yaml b/yolov3/data/GlobalWheat2020.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/GlobalWheat2020.yaml rename to yolov3/data/GlobalWheat2020.yaml diff --git a/ros2_ws/src/yolov3/data/ImageNet.yaml b/yolov3/data/ImageNet.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/ImageNet.yaml rename to yolov3/data/ImageNet.yaml diff --git a/ros2_ws/src/yolov3/data/SKU-110K.yaml b/yolov3/data/SKU-110K.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/SKU-110K.yaml rename to yolov3/data/SKU-110K.yaml diff --git a/ros2_ws/src/yolov3/data/VisDrone.yaml b/yolov3/data/VisDrone.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/VisDrone.yaml rename to yolov3/data/VisDrone.yaml diff --git a/ros2_ws/src/yolov3/data/coco.yaml b/yolov3/data/coco.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/coco.yaml rename to yolov3/data/coco.yaml diff --git a/ros2_ws/src/yolov3/data/coco128-seg.yaml b/yolov3/data/coco128-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/coco128-seg.yaml rename to yolov3/data/coco128-seg.yaml diff --git a/ros2_ws/src/yolov3/data/coco128.yaml b/yolov3/data/coco128.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/coco128.yaml rename to yolov3/data/coco128.yaml diff --git a/ros2_ws/src/yolov3/data/custom-yolov3.yaml b/yolov3/data/custom-yolov3.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/custom-yolov3.yaml rename to yolov3/data/custom-yolov3.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.Objects365.yaml b/yolov3/data/hyps/hyp.Objects365.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.Objects365.yaml rename to yolov3/data/hyps/hyp.Objects365.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.VOC.yaml b/yolov3/data/hyps/hyp.VOC.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.VOC.yaml rename to yolov3/data/hyps/hyp.VOC.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.no-augmentation.yaml b/yolov3/data/hyps/hyp.no-augmentation.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.no-augmentation.yaml rename to yolov3/data/hyps/hyp.no-augmentation.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.scratch-high.yaml b/yolov3/data/hyps/hyp.scratch-high.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.scratch-high.yaml rename to yolov3/data/hyps/hyp.scratch-high.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.scratch-low.yaml b/yolov3/data/hyps/hyp.scratch-low.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.scratch-low.yaml rename to yolov3/data/hyps/hyp.scratch-low.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.scratch-med.yaml b/yolov3/data/hyps/hyp.scratch-med.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.scratch-med.yaml rename to yolov3/data/hyps/hyp.scratch-med.yaml diff --git a/ros2_ws/src/yolov3/data/hyps/hyp.scratch.yaml b/yolov3/data/hyps/hyp.scratch.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/hyps/hyp.scratch.yaml rename to yolov3/data/hyps/hyp.scratch.yaml diff --git a/ros2_ws/src/yolov3/data/images/bus.jpg b/yolov3/data/images/bus.jpg similarity index 100% rename from ros2_ws/src/yolov3/data/images/bus.jpg rename to yolov3/data/images/bus.jpg diff --git a/ros2_ws/src/yolov3/data/images/zidane.jpg b/yolov3/data/images/zidane.jpg similarity index 100% rename from ros2_ws/src/yolov3/data/images/zidane.jpg rename to yolov3/data/images/zidane.jpg diff --git a/ros2_ws/src/yolov3/data/objects365.yaml b/yolov3/data/objects365.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/objects365.yaml rename to yolov3/data/objects365.yaml diff --git a/ros2_ws/src/yolov3/data/scripts/download_weights.sh b/yolov3/data/scripts/download_weights.sh similarity index 100% rename from ros2_ws/src/yolov3/data/scripts/download_weights.sh rename to yolov3/data/scripts/download_weights.sh diff --git a/ros2_ws/src/yolov3/data/scripts/get_coco.sh b/yolov3/data/scripts/get_coco.sh similarity index 100% rename from ros2_ws/src/yolov3/data/scripts/get_coco.sh rename to yolov3/data/scripts/get_coco.sh diff --git a/ros2_ws/src/yolov3/data/scripts/get_coco128.sh b/yolov3/data/scripts/get_coco128.sh similarity index 100% rename from ros2_ws/src/yolov3/data/scripts/get_coco128.sh rename to yolov3/data/scripts/get_coco128.sh diff --git a/ros2_ws/src/yolov3/data/scripts/get_imagenet.sh b/yolov3/data/scripts/get_imagenet.sh similarity index 100% rename from ros2_ws/src/yolov3/data/scripts/get_imagenet.sh rename to yolov3/data/scripts/get_imagenet.sh diff --git a/ros2_ws/src/yolov3/data/voc.yaml b/yolov3/data/voc.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/voc.yaml rename to yolov3/data/voc.yaml diff --git a/ros2_ws/src/yolov3/data/xView.yaml b/yolov3/data/xView.yaml similarity index 100% rename from ros2_ws/src/yolov3/data/xView.yaml rename to yolov3/data/xView.yaml diff --git a/ros2_ws/src/yolov3/detect.py b/yolov3/detect.py similarity index 100% rename from ros2_ws/src/yolov3/detect.py rename to yolov3/detect.py diff --git a/yolov3/detect_oj.py b/yolov3/detect_oj.py new file mode 100644 index 00000000..37356fa6 --- /dev/null +++ b/yolov3/detect_oj.py @@ -0,0 +1,248 @@ +# YOLOv3 🚀 by Ultralytics, GPL-3.0 license +""" +Run inference on images, videos, directories, streams, etc. + +Usage: + $ python path/to/detect.py --weights yolov3.pt --source 0 # webcam + img.jpg # image + vid.mp4 # video + path/ # directory + path/*.jpg # glob + 'https://youtu.be/Zgi9g1ksQHc' # YouTube + 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream +""" + +import argparse +import os +import sys +from pathlib import Path + +import cv2 +import torch +import torch.backends.cudnn as cudnn + +FILE = Path(__file__).resolve() +ROOT = FILE.parents[0] # root directory +if str(ROOT) not in sys.path: + sys.path.append(str(ROOT)) # add ROOT to PATH +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative + +from models.common import DetectMultiBackend +from utils.datasets import IMG_FORMATS, VID_FORMATS, LoadImages, LoadStreams +from utils.general import (LOGGER, check_file, check_img_size, check_imshow, check_requirements, colorstr, + increment_path, non_max_suppression, print_args, scale_coords, strip_optimizer, xyxy2xywh) +from utils.plots import Annotator, colors, save_one_box +from utils.torch_utils import select_device, time_sync + + +@torch.no_grad() +def run(weights=ROOT / 'yolov3.pt', # model.pt path(s) + source=ROOT / 'data/images', # file/dir/URL/glob, 0 for webcam + imgsz=1280, # inference size (pixels) + conf_thres=0.25, # confidence threshold + iou_thres=0.45, # NMS IOU threshold + max_det=1000, # maximum detections per image + device='', # cuda device, i.e. 0 or 0,1,2,3 or cpu + view_img=True, # show results + save_txt=False, # save results to *.txt + save_conf=False, # save confidences in --save-txt labels + save_crop=False, # save cropped prediction boxes + nosave=False, # do not save images/videos + classes=None, # filter by class: --class 0, or --class 0 2 3 + agnostic_nms=False, # class-agnostic NMS + augment=False, # augmented inference + visualize=False, # visualize features + update=False, # update all models + project=ROOT / 'runs/detect', # save results to project/name + name='exp', # save results to project/name + exist_ok=False, # existing project/name ok, do not increment + line_thickness=3, # bounding box thickness (pixels) + hide_labels=False, # hide labels + hide_conf=False, # hide confidences + half=False, # use FP16 half-precision inference + dnn=False, # use OpenCV DNN for ONNX inference + ): + + source = str(source) + save_img = not nosave and not source.endswith('.txt') # save inference images + is_file = Path(source).suffix[1:] in (IMG_FORMATS + VID_FORMATS) + is_url = source.lower().startswith(('rtsp://', 'rtmp://', 'http://', 'https://')) + webcam = source.isnumeric() or source.endswith('.txt') or (is_url and not is_file) + if is_url and is_file: + source = check_file(source) # download + + # Directories + save_dir = increment_path(Path(project) / name, exist_ok=exist_ok) # increment run + (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir + + # Load model + device = select_device(device) + model = DetectMultiBackend(weights, device=device, dnn=dnn) + stride, names, pt, jit, onnx = model.stride, model.names, model.pt, model.jit, model.onnx + imgsz = check_img_size(imgsz, s=stride) # check image size + + # Half + half &= pt and device.type != 'cpu' # half precision only supported by PyTorch on CUDA + if pt: + model.model.half() if half else model.model.float() + # Dataloader + if webcam: + view_img = check_imshow() + cudnn.benchmark = True # set True to speed up constant image size inference + dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt and not jit) + bs = len(dataset) # batch_size + else: + print("in load images") + dataset = LoadImages(source, img_size=imgsz, stride=stride, auto=pt and not jit) + bs = 1 # batch_size + vid_path, vid_writer = [None] * bs, [None] * bs + + # Run inference + if pt and device.type != 'cpu': + model(torch.zeros(1, 3, *imgsz).to(device).type_as(next(model.model.parameters()))) # warmup + dt, seen = [0.0, 0.0, 0.0], 0 + + # Inference + for path, im, im0s, vid_cap, s in dataset: + t1 = time_sync() + im = torch.from_numpy(im).to(device) + im = im.half() if half else im.float() # uint8 to fp16/32 + im /= 255 # 0 - 255 to 0.0 - 1.0 + if len(im.shape) == 3: + im = im[None] # expand for batch dim + t2 = time_sync() + dt[0] += t2 - t1 + + # Inference + visualize = increment_path(save_dir / Path(path).stem, mkdir=True) if visualize else False + pred = model(im, augment=augment, visualize=visualize) + t3 = time_sync() + dt[1] += t3 - t2 + + # NMS + pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det) + dt[2] += time_sync() - t3 + + # Second-stage classifier (optional) + # pred = utils.general.apply_classifier(pred, classifier_model, im, im0s) + + # Process predictions + for i, det in enumerate(pred): # per image + seen += 1 + if webcam: # batch_size >= 1 + p, im0, frame = path[i], im0s[i].copy(), dataset.count + s += f'{i}: ' + else: + p, im0, frame = path, im0s.copy(), getattr(dataset, 'frame', 0) + + p = Path(p) # to Path + save_path = str(save_dir / p.name) # im.jpg + txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}') # im.txt + s += '%gx%g ' % im.shape[2:] # print string + gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh + imc = im0.copy() if save_crop else im0 # for save_crop + annotator = Annotator(im0, line_width=line_thickness, example=str(names)) + if len(det): + # Rescale boxes from img_size to im0 size + det[:, :4] = scale_coords(im.shape[2:], det[:, :4], im0.shape).round() + + # Print results + for c in det[:, -1].unique(): + n = (det[:, -1] == c).sum() # detections per class + s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string + + # Write results + for *xyxy, conf, cls in reversed(det): + if save_txt: # Write to file + xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh + line = (cls, *xywh, conf) if save_conf else (cls, *xywh) # label format + with open(txt_path + '.txt', 'a') as f: + f.write(('%g ' * len(line)).rstrip() % line + '\n') + + if save_img or save_crop or view_img: # Add bbox to image + c = int(cls) # integer class + label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}') + annotator.box_label(xyxy, label, color=colors(c, True)) + if save_crop: + save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True) + + # Print time (inference-only) + LOGGER.info(f'{s}Done. ({t3 - t2:.3f}s)') + import pdb; pdb.set_trace() + + # Stream results + im0 = annotator.result() + if True: + cv2.imshow(str(p), im0) + cv2.waitKey(1) # 1 millisecond + + # Save results (image with detections) + if save_img: + if dataset.mode == 'image': + cv2.imwrite(save_path, im0) + else: # 'video' or 'stream' + if vid_path[i] != save_path: # new video + vid_path[i] = save_path + if isinstance(vid_writer[i], cv2.VideoWriter): + vid_writer[i].release() # release previous video writer + if vid_cap: # video + fps = vid_cap.get(cv2.CAP_PROP_FPS) + w = int(vid_cap.get(cv2.CAP_PROP_FRAME_WIDTH)) + h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) + else: # stream + fps, w, h = 30, im0.shape[1], im0.shape[0] + save_path += '.mp4' + vid_writer[i] = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h)) + vid_writer[i].write(im0) + + # Print results + t = tuple(x / seen * 1E3 for x in dt) # speeds per image + LOGGER.info(f'Speed: %.1fms pre-process, %.1fms inference, %.1fms NMS per image at shape {(1, 3, *imgsz)}' % t) + if save_txt or save_img: + s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else '' + LOGGER.info(f"Results saved to {colorstr('bold', save_dir)}{s}") + if update: + strip_optimizer(weights) # update model (to fix SourceChangeWarning) + + +def parse_opt(): + parser = argparse.ArgumentParser() + parser.add_argument('--weights', nargs='+', type=str, default=ROOT / 'yolov3.pt', help='model path(s)') + parser.add_argument('--source', type=str, default=ROOT / 'data/images', help='file/dir/URL/glob, 0 for webcam') + parser.add_argument('--imgsz', '--img', '--img-size', nargs='+', type=int, default=[640], help='inference size h,w') + parser.add_argument('--conf-thres', type=float, default=0.25, help='confidence threshold') + parser.add_argument('--iou-thres', type=float, default=0.45, help='NMS IoU threshold') + parser.add_argument('--max-det', type=int, default=1000, help='maximum detections per image') + parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') + parser.add_argument('--view-img', action='store_true', help='show results') + parser.add_argument('--save-txt', action='store_true', help='save results to *.txt') + parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels') + parser.add_argument('--save-crop', action='store_true', help='save cropped prediction boxes') + parser.add_argument('--nosave', action='store_true', help='do not save images/videos') + parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --classes 0, or --classes 0 2 3') + parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS') + parser.add_argument('--augment', action='store_true', help='augmented inference') + parser.add_argument('--visualize', action='store_true', help='visualize features') + parser.add_argument('--update', action='store_true', help='update all models') + parser.add_argument('--project', default=ROOT / 'runs/detect', help='save results to project/name') + parser.add_argument('--name', default='exp', help='save results to project/name') + parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') + parser.add_argument('--line-thickness', default=3, type=int, help='bounding box thickness (pixels)') + parser.add_argument('--hide-labels', default=False, action='store_true', help='hide labels') + parser.add_argument('--hide-conf', default=False, action='store_true', help='hide confidences') + parser.add_argument('--half', action='store_true', help='use FP16 half-precision inference') + parser.add_argument('--dnn', action='store_true', help='use OpenCV DNN for ONNX inference') + opt = parser.parse_args() + opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expand + print_args(FILE.stem, opt) + return opt + + +def main(opt): + check_requirements(exclude=('tensorboard', 'thop')) + run(**vars(opt)) + + +if __name__ == "__main__": + opt = parse_opt() + main(opt) diff --git a/ros2_ws/src/yolov3/detect_on_bag.py b/yolov3/detect_on_bag.py similarity index 100% rename from ros2_ws/src/yolov3/detect_on_bag.py rename to yolov3/detect_on_bag.py diff --git a/ros2_ws/src/yolov3/export.py b/yolov3/export.py similarity index 100% rename from ros2_ws/src/yolov3/export.py rename to yolov3/export.py diff --git a/ros2_ws/src/yolov3/hubconf.py b/yolov3/hubconf.py similarity index 100% rename from ros2_ws/src/yolov3/hubconf.py rename to yolov3/hubconf.py diff --git a/yolov3/launch/pipe_detection.launch.py b/yolov3/launch/pipe_detection.launch.py new file mode 100644 index 00000000..2a78a60b --- /dev/null +++ b/yolov3/launch/pipe_detection.launch.py @@ -0,0 +1,33 @@ + +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node + +def generate_launch_description(): + + return LaunchDescription([ + + # SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), + # SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '0'), + + # # Launch arguments + # DeclareLaunchArgument('object_prefix', default_value='testingggggg', description='TF prefix of objects.'), + + # DeclareLaunchArgument('rgb_topic', default_value='rgb_img', description='Image topic.'), + # DeclareLaunchArgument('depth_topic', default_value='depth_img', description='Registered depth topic.'), + # DeclareLaunchArgument('camera_info_topic', default_value='camera_info', description='Camera info topic.'), + # DeclareLaunchArgument('bounding_box_topic', default_value='bboxes', description='Bouding box topic.'), + + # Nodes to launch + Node( + package='yolov3_msg', executable='detect_on_bag.py', output='screen', + # parameters=[{ + # 'object_prefix':LaunchConfiguration('object_prefix'), + # }], + # remappings=[ + # ('rgb_img', LaunchConfiguration('rgb_topic')), + # ('depth_img', LaunchConfiguration('depth_topic')), + # ('camera_info', LaunchConfiguration('camera_info_topic'))] + ), + ]) diff --git a/ros2_ws/src/yolov3/models/__init__.py b/yolov3/models/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/models/__init__.py rename to yolov3/models/__init__.py diff --git a/ros2_ws/src/yolov3/models/common.py b/yolov3/models/common.py similarity index 100% rename from ros2_ws/src/yolov3/models/common.py rename to yolov3/models/common.py diff --git a/ros2_ws/src/yolov3/models/experimental.py b/yolov3/models/experimental.py similarity index 100% rename from ros2_ws/src/yolov3/models/experimental.py rename to yolov3/models/experimental.py diff --git a/ros2_ws/src/yolov3/models/hub/anchors.yaml b/yolov3/models/hub/anchors.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/anchors.yaml rename to yolov3/models/hub/anchors.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-bifpn.yaml b/yolov3/models/hub/yolov5-bifpn.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-bifpn.yaml rename to yolov3/models/hub/yolov5-bifpn.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-fpn.yaml b/yolov3/models/hub/yolov5-fpn.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-fpn.yaml rename to yolov3/models/hub/yolov5-fpn.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-p2.yaml b/yolov3/models/hub/yolov5-p2.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-p2.yaml rename to yolov3/models/hub/yolov5-p2.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-p34.yaml b/yolov3/models/hub/yolov5-p34.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-p34.yaml rename to yolov3/models/hub/yolov5-p34.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-p6.yaml b/yolov3/models/hub/yolov5-p6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-p6.yaml rename to yolov3/models/hub/yolov5-p6.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-p7.yaml b/yolov3/models/hub/yolov5-p7.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-p7.yaml rename to yolov3/models/hub/yolov5-p7.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5-panet.yaml b/yolov3/models/hub/yolov5-panet.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5-panet.yaml rename to yolov3/models/hub/yolov5-panet.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5l6.yaml b/yolov3/models/hub/yolov5l6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5l6.yaml rename to yolov3/models/hub/yolov5l6.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5m6.yaml b/yolov3/models/hub/yolov5m6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5m6.yaml rename to yolov3/models/hub/yolov5m6.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5n6.yaml b/yolov3/models/hub/yolov5n6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5n6.yaml rename to yolov3/models/hub/yolov5n6.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5s-LeakyReLU.yaml b/yolov3/models/hub/yolov5s-LeakyReLU.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5s-LeakyReLU.yaml rename to yolov3/models/hub/yolov5s-LeakyReLU.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5s-ghost.yaml b/yolov3/models/hub/yolov5s-ghost.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5s-ghost.yaml rename to yolov3/models/hub/yolov5s-ghost.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5s-transformer.yaml b/yolov3/models/hub/yolov5s-transformer.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5s-transformer.yaml rename to yolov3/models/hub/yolov5s-transformer.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5s6.yaml b/yolov3/models/hub/yolov5s6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5s6.yaml rename to yolov3/models/hub/yolov5s6.yaml diff --git a/ros2_ws/src/yolov3/models/hub/yolov5x6.yaml b/yolov3/models/hub/yolov5x6.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/hub/yolov5x6.yaml rename to yolov3/models/hub/yolov5x6.yaml diff --git a/ros2_ws/src/yolov3/models/segment/yolov5l-seg.yaml b/yolov3/models/segment/yolov5l-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/segment/yolov5l-seg.yaml rename to yolov3/models/segment/yolov5l-seg.yaml diff --git a/ros2_ws/src/yolov3/models/segment/yolov5m-seg.yaml b/yolov3/models/segment/yolov5m-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/segment/yolov5m-seg.yaml rename to yolov3/models/segment/yolov5m-seg.yaml diff --git a/ros2_ws/src/yolov3/models/segment/yolov5n-seg.yaml b/yolov3/models/segment/yolov5n-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/segment/yolov5n-seg.yaml rename to yolov3/models/segment/yolov5n-seg.yaml diff --git a/ros2_ws/src/yolov3/models/segment/yolov5s-seg.yaml b/yolov3/models/segment/yolov5s-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/segment/yolov5s-seg.yaml rename to yolov3/models/segment/yolov5s-seg.yaml diff --git a/ros2_ws/src/yolov3/models/segment/yolov5x-seg.yaml b/yolov3/models/segment/yolov5x-seg.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/segment/yolov5x-seg.yaml rename to yolov3/models/segment/yolov5x-seg.yaml diff --git a/ros2_ws/src/yolov3/models/tf.py b/yolov3/models/tf.py similarity index 100% rename from ros2_ws/src/yolov3/models/tf.py rename to yolov3/models/tf.py diff --git a/ros2_ws/src/yolov3/models/yolo.py b/yolov3/models/yolo.py similarity index 100% rename from ros2_ws/src/yolov3/models/yolo.py rename to yolov3/models/yolo.py diff --git a/ros2_ws/src/yolov3/models/yolov3-spp.yaml b/yolov3/models/yolov3-spp.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov3-spp.yaml rename to yolov3/models/yolov3-spp.yaml diff --git a/ros2_ws/src/yolov3/models/yolov3-tiny.yaml b/yolov3/models/yolov3-tiny.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov3-tiny.yaml rename to yolov3/models/yolov3-tiny.yaml diff --git a/ros2_ws/src/yolov3/models/yolov3.yaml b/yolov3/models/yolov3.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov3.yaml rename to yolov3/models/yolov3.yaml diff --git a/ros2_ws/src/yolov3/models/yolov5l.yaml b/yolov3/models/yolov5l.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov5l.yaml rename to yolov3/models/yolov5l.yaml diff --git a/ros2_ws/src/yolov3/models/yolov5m.yaml b/yolov3/models/yolov5m.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov5m.yaml rename to yolov3/models/yolov5m.yaml diff --git a/ros2_ws/src/yolov3/models/yolov5n.yaml b/yolov3/models/yolov5n.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov5n.yaml rename to yolov3/models/yolov5n.yaml diff --git a/ros2_ws/src/yolov3/models/yolov5s.yaml b/yolov3/models/yolov5s.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov5s.yaml rename to yolov3/models/yolov5s.yaml diff --git a/ros2_ws/src/yolov3/models/yolov5x.yaml b/yolov3/models/yolov5x.yaml similarity index 100% rename from ros2_ws/src/yolov3/models/yolov5x.yaml rename to yolov3/models/yolov5x.yaml diff --git a/ros2_ws/src/yolov3/msg/BoundingBox.msg b/yolov3/msg/BoundingBox.msg similarity index 100% rename from ros2_ws/src/yolov3/msg/BoundingBox.msg rename to yolov3/msg/BoundingBox.msg diff --git a/ros2_ws/src/yolov3/msg/BoundingBoxes.msg b/yolov3/msg/BoundingBoxes.msg similarity index 100% rename from ros2_ws/src/yolov3/msg/BoundingBoxes.msg rename to yolov3/msg/BoundingBoxes.msg diff --git a/ros2_ws/src/yolov3/package.xml b/yolov3/package.xml similarity index 100% rename from ros2_ws/src/yolov3/package.xml rename to yolov3/package.xml diff --git a/ros2_ws/src/yolov3/requirements.txt b/yolov3/requirements.txt similarity index 100% rename from ros2_ws/src/yolov3/requirements.txt rename to yolov3/requirements.txt diff --git a/ros2_ws/src/yolov3/runs-20230212T095309Z-001.zip b/yolov3/runs-20230212T095309Z-001.zip similarity index 100% rename from ros2_ws/src/yolov3/runs-20230212T095309Z-001.zip rename to yolov3/runs-20230212T095309Z-001.zip diff --git a/ros2_ws/src/yolov3/segment/predict.py b/yolov3/segment/predict.py similarity index 100% rename from ros2_ws/src/yolov3/segment/predict.py rename to yolov3/segment/predict.py diff --git a/ros2_ws/src/yolov3/segment/train.py b/yolov3/segment/train.py similarity index 100% rename from ros2_ws/src/yolov3/segment/train.py rename to yolov3/segment/train.py diff --git a/ros2_ws/src/yolov3/segment/tutorial.ipynb b/yolov3/segment/tutorial.ipynb similarity index 100% rename from ros2_ws/src/yolov3/segment/tutorial.ipynb rename to yolov3/segment/tutorial.ipynb diff --git a/ros2_ws/src/yolov3/segment/val.py b/yolov3/segment/val.py similarity index 100% rename from ros2_ws/src/yolov3/segment/val.py rename to yolov3/segment/val.py diff --git a/ros2_ws/src/yolov3/setup.cfg b/yolov3/setup.cfg similarity index 100% rename from ros2_ws/src/yolov3/setup.cfg rename to yolov3/setup.cfg diff --git a/yolov3/setup.py b/yolov3/setup.py new file mode 100644 index 00000000..a1bdf9dd --- /dev/null +++ b/yolov3/setup.py @@ -0,0 +1,26 @@ +from setuptools import setup + +package_name = 'yolov3_msg' + +setup( + name=package_name, + version='0.0.0', + packages=[package_name], + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='parallels', + maintainer_email='eic.apoorva@gmail.com', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'yolov3_msg = yolov3_msg.detect_on_bag:main', + ], + }, +) \ No newline at end of file diff --git a/ros2_ws/src/yolov3/train.py b/yolov3/train.py similarity index 100% rename from ros2_ws/src/yolov3/train.py rename to yolov3/train.py diff --git a/ros2_ws/src/yolov3/tutorial.ipynb b/yolov3/tutorial.ipynb similarity index 100% rename from ros2_ws/src/yolov3/tutorial.ipynb rename to yolov3/tutorial.ipynb diff --git a/ros2_ws/src/yolov3/utils/__init__.py b/yolov3/utils/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/__init__.py rename to yolov3/utils/__init__.py diff --git a/ros2_ws/src/yolov3/utils/activations.py b/yolov3/utils/activations.py similarity index 100% rename from ros2_ws/src/yolov3/utils/activations.py rename to yolov3/utils/activations.py diff --git a/ros2_ws/src/yolov3/utils/augmentations.py b/yolov3/utils/augmentations.py similarity index 100% rename from ros2_ws/src/yolov3/utils/augmentations.py rename to yolov3/utils/augmentations.py diff --git a/ros2_ws/src/yolov3/utils/autoanchor.py b/yolov3/utils/autoanchor.py similarity index 100% rename from ros2_ws/src/yolov3/utils/autoanchor.py rename to yolov3/utils/autoanchor.py diff --git a/ros2_ws/src/yolov3/utils/autobatch.py b/yolov3/utils/autobatch.py similarity index 100% rename from ros2_ws/src/yolov3/utils/autobatch.py rename to yolov3/utils/autobatch.py diff --git a/ros2_ws/src/yolov3/utils/aws/__init__.py b/yolov3/utils/aws/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/aws/__init__.py rename to yolov3/utils/aws/__init__.py diff --git a/ros2_ws/src/yolov3/utils/aws/mime.sh b/yolov3/utils/aws/mime.sh similarity index 100% rename from ros2_ws/src/yolov3/utils/aws/mime.sh rename to yolov3/utils/aws/mime.sh diff --git a/ros2_ws/src/yolov3/utils/aws/resume.py b/yolov3/utils/aws/resume.py similarity index 100% rename from ros2_ws/src/yolov3/utils/aws/resume.py rename to yolov3/utils/aws/resume.py diff --git a/ros2_ws/src/yolov3/utils/aws/userdata.sh b/yolov3/utils/aws/userdata.sh similarity index 100% rename from ros2_ws/src/yolov3/utils/aws/userdata.sh rename to yolov3/utils/aws/userdata.sh diff --git a/ros2_ws/src/yolov3/utils/callbacks.py b/yolov3/utils/callbacks.py similarity index 100% rename from ros2_ws/src/yolov3/utils/callbacks.py rename to yolov3/utils/callbacks.py diff --git a/ros2_ws/src/yolov3/utils/dataloaders.py b/yolov3/utils/dataloaders.py similarity index 100% rename from ros2_ws/src/yolov3/utils/dataloaders.py rename to yolov3/utils/dataloaders.py diff --git a/yolov3/utils/datasets.py b/yolov3/utils/datasets.py new file mode 100755 index 00000000..462d561a --- /dev/null +++ b/yolov3/utils/datasets.py @@ -0,0 +1,1036 @@ +# YOLOv3 🚀 by Ultralytics, GPL-3.0 license +""" +Dataloaders and dataset utils +""" + +import glob +import hashlib +import json +import os +import random +import shutil +import time +from itertools import repeat +from multiprocessing.pool import Pool, ThreadPool +from pathlib import Path +from threading import Thread +from zipfile import ZipFile + +import cv2 +import numpy as np +import torch +import torch.nn.functional as F +import yaml +from PIL import ExifTags, Image, ImageOps +from torch.utils.data import DataLoader, Dataset, dataloader, distributed +from tqdm import tqdm + +from utils.augmentations import Albumentations, augment_hsv, copy_paste, letterbox, mixup, random_perspective +from utils.general import (LOGGER, check_dataset, check_requirements, check_yaml, clean_str, segments2boxes, xyn2xy, + xywh2xyxy, xywhn2xyxy, xyxy2xywhn) +from utils.torch_utils import torch_distributed_zero_first + +# Parameters +HELP_URL = 'https://github.com/ultralytics/yolov3/wiki/Train-Custom-Data' +IMG_FORMATS = ['bmp', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'dng', 'webp', 'mpo'] # acceptable image suffixes +VID_FORMATS = ['mov', 'avi', 'mp4', 'mpg', 'mpeg', 'm4v', 'wmv', 'mkv'] # acceptable video suffixes +WORLD_SIZE = int(os.getenv('WORLD_SIZE', 1)) # DPP +NUM_THREADS = min(8, os.cpu_count()) # number of multiprocessing threads + +# Get orientation exif tag +for orientation in ExifTags.TAGS.keys(): + if ExifTags.TAGS[orientation] == 'Orientation': + break + + +def get_hash(paths): + # Returns a single hash value of a list of paths (files or dirs) + size = sum(os.path.getsize(p) for p in paths if os.path.exists(p)) # sizes + h = hashlib.md5(str(size).encode()) # hash sizes + h.update(''.join(paths).encode()) # hash paths + return h.hexdigest() # return hash + + +def exif_size(img): + # Returns exif-corrected PIL size + s = img.size # (width, height) + try: + rotation = dict(img._getexif().items())[orientation] + if rotation == 6: # rotation 270 + s = (s[1], s[0]) + elif rotation == 8: # rotation 90 + s = (s[1], s[0]) + except: + pass + + return s + + +def exif_transpose(image): + """ + Transpose a PIL image accordingly if it has an EXIF Orientation tag. + Inplace version of https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageOps.py exif_transpose() + + :param image: The image to transpose. + :return: An image. + """ + exif = image.getexif() + orientation = exif.get(0x0112, 1) # default 1 + if orientation > 1: + method = {2: Image.FLIP_LEFT_RIGHT, + 3: Image.ROTATE_180, + 4: Image.FLIP_TOP_BOTTOM, + 5: Image.TRANSPOSE, + 6: Image.ROTATE_270, + 7: Image.TRANSVERSE, + 8: Image.ROTATE_90, + }.get(orientation) + if method is not None: + image = image.transpose(method) + del exif[0x0112] + image.info["exif"] = exif.tobytes() + return image + + +def create_dataloader(path, imgsz, batch_size, stride, single_cls=False, hyp=None, augment=False, cache=False, pad=0.0, + rect=False, rank=-1, workers=8, image_weights=False, quad=False, prefix='', shuffle=False): + if rect and shuffle: + LOGGER.warning('WARNING: --rect is incompatible with DataLoader shuffle, setting shuffle=False') + shuffle = False + with torch_distributed_zero_first(rank): # init dataset *.cache only once if DDP + dataset = LoadImagesAndLabels(path, imgsz, batch_size, + augment=augment, # augmentation + hyp=hyp, # hyperparameters + rect=rect, # rectangular batches + cache_images=cache, + single_cls=single_cls, + stride=int(stride), + pad=pad, + image_weights=image_weights, + prefix=prefix) + + batch_size = min(batch_size, len(dataset)) + nw = min([os.cpu_count() // WORLD_SIZE, batch_size if batch_size > 1 else 0, workers]) # number of workers + sampler = None if rank == -1 else distributed.DistributedSampler(dataset, shuffle=shuffle) + loader = DataLoader if image_weights else InfiniteDataLoader # only DataLoader allows for attribute updates + return loader(dataset, + batch_size=batch_size, + shuffle=shuffle and sampler is None, + num_workers=nw, + sampler=sampler, + pin_memory=True, + collate_fn=LoadImagesAndLabels.collate_fn4 if quad else LoadImagesAndLabels.collate_fn), dataset + + +class InfiniteDataLoader(dataloader.DataLoader): + """ Dataloader that reuses workers + + Uses same syntax as vanilla DataLoader + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + object.__setattr__(self, 'batch_sampler', _RepeatSampler(self.batch_sampler)) + self.iterator = super().__iter__() + + def __len__(self): + return len(self.batch_sampler.sampler) + + def __iter__(self): + for i in range(len(self)): + yield next(self.iterator) + + +class _RepeatSampler: + """ Sampler that repeats forever + + Args: + sampler (Sampler) + """ + + def __init__(self, sampler): + self.sampler = sampler + + def __iter__(self): + while True: + yield from iter(self.sampler) + + +class LoadImages: + # image/video dataloader, i.e. `python detect.py --source image.jpg/vid.mp4` + def __init__(self, path, img_size=640, stride=32, auto=True): + p = str(Path(path).resolve()) # os-agnostic absolute path + if '*' in p: + files = sorted(glob.glob(p, recursive=True)) # glob + elif os.path.isdir(p): + files = sorted(glob.glob(os.path.join(p, '*.*'))) # dir + elif os.path.isfile(p): + files = [p] # files + else: + raise Exception(f'ERROR: {p} does not exist') + + images = [x for x in files if x.split('.')[-1].lower() in IMG_FORMATS] + videos = [x for x in files if x.split('.')[-1].lower() in VID_FORMATS] + ni, nv = len(images), len(videos) + + self.img_size = img_size + self.stride = stride + self.files = images + videos + self.nf = ni + nv # number of files + self.video_flag = [False] * ni + [True] * nv + self.mode = 'image' + self.auto = auto + if any(videos): + self.new_video(videos[0]) # new video + else: + self.cap = None + assert self.nf > 0, f'No images or videos found in {p}. ' \ + f'Supported formats are:\nimages: {IMG_FORMATS}\nvideos: {VID_FORMATS}' + + def __iter__(self): + self.count = 0 + return self + + def __next__(self): + if self.count == self.nf: + raise StopIteration + path = self.files[self.count] + + if self.video_flag[self.count]: + # Read video + self.mode = 'video' + ret_val, img0 = self.cap.read() + if not ret_val: + self.count += 1 + self.cap.release() + if self.count == self.nf: # last video + raise StopIteration + else: + path = self.files[self.count] + self.new_video(path) + ret_val, img0 = self.cap.read() + + self.frame += 1 + s = f'video {self.count + 1}/{self.nf} ({self.frame}/{self.frames}) {path}: ' + + else: + # Read image + self.count += 1 + img0 = cv2.imread(path) # BGR + assert img0 is not None, f'Image Not Found {path}' + s = f'image {self.count}/{self.nf} {path}: ' + + # Padded resize + img = letterbox(img0, self.img_size, stride=self.stride, auto=self.auto)[0] + + # Convert + img = img.transpose((2, 0, 1))[::-1] # HWC to CHW, BGR to RGB + img = np.ascontiguousarray(img) + + return path, img, img0, self.cap, s + + def new_video(self, path): + self.frame = 0 + self.cap = cv2.VideoCapture(path) + self.frames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT)) + + def __len__(self): + return self.nf # number of files + + +class LoadWebcam: # for inference + # local webcam dataloader, i.e. `python detect.py --source 0` + def __init__(self, pipe='0', img_size=640, stride=32): + self.img_size = img_size + self.stride = stride + self.pipe = eval(pipe) if pipe.isnumeric() else pipe + self.cap = cv2.VideoCapture(self.pipe) # video capture object + self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 3) # set buffer size + + def __iter__(self): + self.count = -1 + return self + + def __next__(self): + self.count += 1 + if cv2.waitKey(1) == ord('q'): # q to quit + self.cap.release() + cv2.destroyAllWindows() + raise StopIteration + + # Read frame + ret_val, img0 = self.cap.read() + img0 = cv2.flip(img0, 1) # flip left-right + + # Print + assert ret_val, f'Camera Error {self.pipe}' + img_path = 'webcam.jpg' + s = f'webcam {self.count}: ' + + # Padded resize + img = letterbox(img0, self.img_size, stride=self.stride)[0] + + # Convert + img = img.transpose((2, 0, 1))[::-1] # HWC to CHW, BGR to RGB + img = np.ascontiguousarray(img) + + return img_path, img, img0, None, s + + def __len__(self): + return 0 + + +class LoadStreams: + # streamloader, i.e. `python detect.py --source 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP streams` + def __init__(self, sources='streams.txt', img_size=640, stride=32, auto=True): + self.mode = 'stream' + self.img_size = img_size + self.stride = stride + + if os.path.isfile(sources): + with open(sources) as f: + sources = [x.strip() for x in f.read().strip().splitlines() if len(x.strip())] + else: + sources = [sources] + + n = len(sources) + self.imgs, self.fps, self.frames, self.threads = [None] * n, [0] * n, [0] * n, [None] * n + self.sources = [clean_str(x) for x in sources] # clean source names for later + self.auto = auto + for i, s in enumerate(sources): # index, source + # Start thread to read frames from video stream + st = f'{i + 1}/{n}: {s}... ' + if 'youtube.com/' in s or 'youtu.be/' in s: # if source is YouTube video + check_requirements(('pafy', 'youtube_dl')) + import pafy + s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL + s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam + cap = cv2.VideoCapture(s) + assert cap.isOpened(), f'{st}Failed to open {s}' + w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) + h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) + self.fps[i] = max(cap.get(cv2.CAP_PROP_FPS) % 100, 0) or 30.0 # 30 FPS fallback + self.frames[i] = max(int(cap.get(cv2.CAP_PROP_FRAME_COUNT)), 0) or float('inf') # infinite stream fallback + + _, self.imgs[i] = cap.read() # guarantee first frame + self.threads[i] = Thread(target=self.update, args=([i, cap, s]), daemon=True) + LOGGER.info(f"{st} Success ({self.frames[i]} frames {w}x{h} at {self.fps[i]:.2f} FPS)") + self.threads[i].start() + LOGGER.info('') # newline + + # check for common shapes + s = np.stack([letterbox(x, self.img_size, stride=self.stride, auto=self.auto)[0].shape for x in self.imgs]) + self.rect = np.unique(s, axis=0).shape[0] == 1 # rect inference if all shapes equal + if not self.rect: + LOGGER.warning('WARNING: Stream shapes differ. For optimal performance supply similarly-shaped streams.') + + def update(self, i, cap, stream): + # Read stream `i` frames in daemon thread + n, f, read = 0, self.frames[i], 1 # frame number, frame array, inference every 'read' frame + while cap.isOpened() and n < f: + n += 1 + # _, self.imgs[index] = cap.read() + cap.grab() + if n % read == 0: + success, im = cap.retrieve() + if success: + self.imgs[i] = im + else: + LOGGER.warning('WARNING: Video stream unresponsive, please check your IP camera connection.') + self.imgs[i] *= 0 + cap.open(stream) # re-open stream if signal was lost + time.sleep(1 / self.fps[i]) # wait time + + def __iter__(self): + self.count = -1 + return self + + def __next__(self): + self.count += 1 + if not all(x.is_alive() for x in self.threads) or cv2.waitKey(1) == ord('q'): # q to quit + cv2.destroyAllWindows() + raise StopIteration + + # Letterbox + img0 = self.imgs.copy() + img = [letterbox(x, self.img_size, stride=self.stride, auto=self.rect and self.auto)[0] for x in img0] + + # Stack + img = np.stack(img, 0) + + # Convert + img = img[..., ::-1].transpose((0, 3, 1, 2)) # BGR to RGB, BHWC to BCHW + img = np.ascontiguousarray(img) + + return self.sources, img, img0, None, '' + + def __len__(self): + return len(self.sources) # 1E12 frames = 32 streams at 30 FPS for 30 years + + +def img2label_paths(img_paths): + # Define label paths as a function of image paths + sa, sb = os.sep + 'images' + os.sep, os.sep + 'labels' + os.sep # /images/, /labels/ substrings + return [sb.join(x.rsplit(sa, 1)).rsplit('.', 1)[0] + '.txt' for x in img_paths] + + +class LoadImagesAndLabels(Dataset): + # train_loader/val_loader, loads images and labels for training and validation + cache_version = 0.6 # dataset labels *.cache version + + def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, rect=False, image_weights=False, + cache_images=False, single_cls=False, stride=32, pad=0.0, prefix=''): + self.img_size = img_size + self.augment = augment + self.hyp = hyp + self.image_weights = image_weights + self.rect = False if image_weights else rect + self.mosaic = self.augment and not self.rect # load 4 images at a time into a mosaic (only during training) + self.mosaic_border = [-img_size // 2, -img_size // 2] + self.stride = stride + self.path = path + self.albumentations = Albumentations() if augment else None + + try: + f = [] # image files + for p in path if isinstance(path, list) else [path]: + p = Path(p) # os-agnostic + if p.is_dir(): # dir + f += glob.glob(str(p / '**' / '*.*'), recursive=True) + # f = list(p.rglob('*.*')) # pathlib + elif p.is_file(): # file + with open(p) as t: + t = t.read().strip().splitlines() + parent = str(p.parent) + os.sep + f += [x.replace('./', parent) if x.startswith('./') else x for x in t] # local to global path + # f += [p.parent / x.lstrip(os.sep) for x in t] # local to global path (pathlib) + else: + raise Exception(f'{prefix}{p} does not exist') + self.img_files = sorted(x.replace('/', os.sep) for x in f if x.split('.')[-1].lower() in IMG_FORMATS) + # self.img_files = sorted([x for x in f if x.suffix[1:].lower() in IMG_FORMATS]) # pathlib + assert self.img_files, f'{prefix}No images found' + except Exception as e: + raise Exception(f'{prefix}Error loading data from {path}: {e}\nSee {HELP_URL}') + + # Check cache + self.label_files = img2label_paths(self.img_files) # labels + cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache') + try: + cache, exists = np.load(cache_path, allow_pickle=True).item(), True # load dict + assert cache['version'] == self.cache_version # same version + assert cache['hash'] == get_hash(self.label_files + self.img_files) # same hash + except: + cache, exists = self.cache_labels(cache_path, prefix), False # cache + + # Display cache + nf, nm, ne, nc, n = cache.pop('results') # found, missing, empty, corrupted, total + if exists: + d = f"Scanning '{cache_path}' images and labels... {nf} found, {nm} missing, {ne} empty, {nc} corrupted" + tqdm(None, desc=prefix + d, total=n, initial=n) # display cache results + if cache['msgs']: + LOGGER.info('\n'.join(cache['msgs'])) # display warnings + assert nf > 0 or not augment, f'{prefix}No labels in {cache_path}. Can not train without labels. See {HELP_URL}' + + # Read cache + [cache.pop(k) for k in ('hash', 'version', 'msgs')] # remove items + labels, shapes, self.segments = zip(*cache.values()) + self.labels = list(labels) + self.shapes = np.array(shapes, dtype=np.float64) + self.img_files = list(cache.keys()) # update + self.label_files = img2label_paths(cache.keys()) # update + n = len(shapes) # number of images + bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index + nb = bi[-1] + 1 # number of batches + self.batch = bi # batch index of image + self.n = n + self.indices = range(n) + + # Update labels + include_class = [] # filter labels to include only these classes (optional) + include_class_array = np.array(include_class).reshape(1, -1) + for i, (label, segment) in enumerate(zip(self.labels, self.segments)): + if include_class: + j = (label[:, 0:1] == include_class_array).any(1) + self.labels[i] = label[j] + if segment: + self.segments[i] = segment[j] + if single_cls: # single-class training, merge all classes into 0 + self.labels[i][:, 0] = 0 + if segment: + self.segments[i][:, 0] = 0 + + # Rectangular Training + if self.rect: + # Sort by aspect ratio + s = self.shapes # wh + ar = s[:, 1] / s[:, 0] # aspect ratio + irect = ar.argsort() + self.img_files = [self.img_files[i] for i in irect] + self.label_files = [self.label_files[i] for i in irect] + self.labels = [self.labels[i] for i in irect] + self.shapes = s[irect] # wh + ar = ar[irect] + + # Set training image shapes + shapes = [[1, 1]] * nb + for i in range(nb): + ari = ar[bi == i] + mini, maxi = ari.min(), ari.max() + if maxi < 1: + shapes[i] = [maxi, 1] + elif mini > 1: + shapes[i] = [1, 1 / mini] + + self.batch_shapes = np.ceil(np.array(shapes) * img_size / stride + pad).astype(np.int) * stride + + # Cache images into memory for faster training (WARNING: large datasets may exceed system RAM) + self.imgs, self.img_npy = [None] * n, [None] * n + if cache_images: + if cache_images == 'disk': + self.im_cache_dir = Path(Path(self.img_files[0]).parent.as_posix() + '_npy') + self.img_npy = [self.im_cache_dir / Path(f).with_suffix('.npy').name for f in self.img_files] + self.im_cache_dir.mkdir(parents=True, exist_ok=True) + gb = 0 # Gigabytes of cached images + self.img_hw0, self.img_hw = [None] * n, [None] * n + results = ThreadPool(NUM_THREADS).imap(lambda x: load_image(*x), zip(repeat(self), range(n))) + pbar = tqdm(enumerate(results), total=n) + for i, x in pbar: + if cache_images == 'disk': + if not self.img_npy[i].exists(): + np.save(self.img_npy[i].as_posix(), x[0]) + gb += self.img_npy[i].stat().st_size + else: + self.imgs[i], self.img_hw0[i], self.img_hw[i] = x # im, hw_orig, hw_resized = load_image(self, i) + gb += self.imgs[i].nbytes + pbar.desc = f'{prefix}Caching images ({gb / 1E9:.1f}GB {cache_images})' + pbar.close() + + def cache_labels(self, path=Path('./labels.cache'), prefix=''): + # Cache dataset labels, check images and read shapes + x = {} # dict + nm, nf, ne, nc, msgs = 0, 0, 0, 0, [] # number missing, found, empty, corrupt, messages + desc = f"{prefix}Scanning '{path.parent / path.stem}' images and labels..." + with Pool(NUM_THREADS) as pool: + pbar = tqdm(pool.imap(verify_image_label, zip(self.img_files, self.label_files, repeat(prefix))), + desc=desc, total=len(self.img_files)) + for im_file, l, shape, segments, nm_f, nf_f, ne_f, nc_f, msg in pbar: + nm += nm_f + nf += nf_f + ne += ne_f + nc += nc_f + if im_file: + x[im_file] = [l, shape, segments] + if msg: + msgs.append(msg) + pbar.desc = f"{desc}{nf} found, {nm} missing, {ne} empty, {nc} corrupted" + + pbar.close() + if msgs: + LOGGER.info('\n'.join(msgs)) + if nf == 0: + LOGGER.warning(f'{prefix}WARNING: No labels found in {path}. See {HELP_URL}') + x['hash'] = get_hash(self.label_files + self.img_files) + x['results'] = nf, nm, ne, nc, len(self.img_files) + x['msgs'] = msgs # warnings + x['version'] = self.cache_version # cache version + try: + np.save(path, x) # save cache for next time + path.with_suffix('.cache.npy').rename(path) # remove .npy suffix + LOGGER.info(f'{prefix}New cache created: {path}') + except Exception as e: + LOGGER.warning(f'{prefix}WARNING: Cache directory {path.parent} is not writeable: {e}') # not writeable + return x + + def __len__(self): + return len(self.img_files) + + # def __iter__(self): + # self.count = -1 + # print('ran dataset iter') + # #self.shuffled_vector = np.random.permutation(self.nF) if self.augment else np.arange(self.nF) + # return self + + def __getitem__(self, index): + index = self.indices[index] # linear, shuffled, or image_weights + + hyp = self.hyp + mosaic = self.mosaic and random.random() < hyp['mosaic'] + if mosaic: + # Load mosaic + img, labels = load_mosaic(self, index) + shapes = None + + # MixUp augmentation + if random.random() < hyp['mixup']: + img, labels = mixup(img, labels, *load_mosaic(self, random.randint(0, self.n - 1))) + + else: + # Load image + img, (h0, w0), (h, w) = load_image(self, index) + + # Letterbox + shape = self.batch_shapes[self.batch[index]] if self.rect else self.img_size # final letterboxed shape + img, ratio, pad = letterbox(img, shape, auto=False, scaleup=self.augment) + shapes = (h0, w0), ((h / h0, w / w0), pad) # for COCO mAP rescaling + + labels = self.labels[index].copy() + if labels.size: # normalized xywh to pixel xyxy format + labels[:, 1:] = xywhn2xyxy(labels[:, 1:], ratio[0] * w, ratio[1] * h, padw=pad[0], padh=pad[1]) + + if self.augment: + img, labels = random_perspective(img, labels, + degrees=hyp['degrees'], + translate=hyp['translate'], + scale=hyp['scale'], + shear=hyp['shear'], + perspective=hyp['perspective']) + + nl = len(labels) # number of labels + if nl: + labels[:, 1:5] = xyxy2xywhn(labels[:, 1:5], w=img.shape[1], h=img.shape[0], clip=True, eps=1E-3) + + if self.augment: + # Albumentations + img, labels = self.albumentations(img, labels) + nl = len(labels) # update after albumentations + + # HSV color-space + augment_hsv(img, hgain=hyp['hsv_h'], sgain=hyp['hsv_s'], vgain=hyp['hsv_v']) + + # Flip up-down + if random.random() < hyp['flipud']: + img = np.flipud(img) + if nl: + labels[:, 2] = 1 - labels[:, 2] + + # Flip left-right + if random.random() < hyp['fliplr']: + img = np.fliplr(img) + if nl: + labels[:, 1] = 1 - labels[:, 1] + + # Cutouts + # labels = cutout(img, labels, p=0.5) + + labels_out = torch.zeros((nl, 6)) + if nl: + labels_out[:, 1:] = torch.from_numpy(labels) + + # Convert + img = img.transpose((2, 0, 1))[::-1] # HWC to CHW, BGR to RGB + img = np.ascontiguousarray(img) + + return torch.from_numpy(img), labels_out, self.img_files[index], shapes + + @staticmethod + def collate_fn(batch): + img, label, path, shapes = zip(*batch) # transposed + for i, l in enumerate(label): + l[:, 0] = i # add target image index for build_targets() + return torch.stack(img, 0), torch.cat(label, 0), path, shapes + + @staticmethod + def collate_fn4(batch): + img, label, path, shapes = zip(*batch) # transposed + n = len(shapes) // 4 + img4, label4, path4, shapes4 = [], [], path[:n], shapes[:n] + + ho = torch.tensor([[0.0, 0, 0, 1, 0, 0]]) + wo = torch.tensor([[0.0, 0, 1, 0, 0, 0]]) + s = torch.tensor([[1, 1, 0.5, 0.5, 0.5, 0.5]]) # scale + for i in range(n): # zidane torch.zeros(16,3,720,1280) # BCHW + i *= 4 + if random.random() < 0.5: + im = F.interpolate(img[i].unsqueeze(0).float(), scale_factor=2.0, mode='bilinear', align_corners=False)[ + 0].type(img[i].type()) + l = label[i] + else: + im = torch.cat((torch.cat((img[i], img[i + 1]), 1), torch.cat((img[i + 2], img[i + 3]), 1)), 2) + l = torch.cat((label[i], label[i + 1] + ho, label[i + 2] + wo, label[i + 3] + ho + wo), 0) * s + img4.append(im) + label4.append(l) + + for i, l in enumerate(label4): + l[:, 0] = i # add target image index for build_targets() + + return torch.stack(img4, 0), torch.cat(label4, 0), path4, shapes4 + + +# Ancillary functions -------------------------------------------------------------------------------------------------- +def load_image(self, i): + # loads 1 image from dataset index 'i', returns im, original hw, resized hw + im = self.imgs[i] + if im is None: # not cached in ram + npy = self.img_npy[i] + if npy and npy.exists(): # load npy + im = np.load(npy) + else: # read image + path = self.img_files[i] + im = cv2.imread(path) # BGR + assert im is not None, f'Image Not Found {path}' + h0, w0 = im.shape[:2] # orig hw + r = self.img_size / max(h0, w0) # ratio + if r != 1: # if sizes are not equal + im = cv2.resize(im, (int(w0 * r), int(h0 * r)), + interpolation=cv2.INTER_AREA if r < 1 and not self.augment else cv2.INTER_LINEAR) + return im, (h0, w0), im.shape[:2] # im, hw_original, hw_resized + else: + return self.imgs[i], self.img_hw0[i], self.img_hw[i] # im, hw_original, hw_resized + + +def load_mosaic(self, index): + # 4-mosaic loader. Loads 1 image + 3 random images into a 4-image mosaic + labels4, segments4 = [], [] + s = self.img_size + yc, xc = (int(random.uniform(-x, 2 * s + x)) for x in self.mosaic_border) # mosaic center x, y + indices = [index] + random.choices(self.indices, k=3) # 3 additional image indices + random.shuffle(indices) + for i, index in enumerate(indices): + # Load image + img, _, (h, w) = load_image(self, index) + + # place img in img4 + if i == 0: # top left + img4 = np.full((s * 2, s * 2, img.shape[2]), 114, dtype=np.uint8) # base image with 4 tiles + x1a, y1a, x2a, y2a = max(xc - w, 0), max(yc - h, 0), xc, yc # xmin, ymin, xmax, ymax (large image) + x1b, y1b, x2b, y2b = w - (x2a - x1a), h - (y2a - y1a), w, h # xmin, ymin, xmax, ymax (small image) + elif i == 1: # top right + x1a, y1a, x2a, y2a = xc, max(yc - h, 0), min(xc + w, s * 2), yc + x1b, y1b, x2b, y2b = 0, h - (y2a - y1a), min(w, x2a - x1a), h + elif i == 2: # bottom left + x1a, y1a, x2a, y2a = max(xc - w, 0), yc, xc, min(s * 2, yc + h) + x1b, y1b, x2b, y2b = w - (x2a - x1a), 0, w, min(y2a - y1a, h) + elif i == 3: # bottom right + x1a, y1a, x2a, y2a = xc, yc, min(xc + w, s * 2), min(s * 2, yc + h) + x1b, y1b, x2b, y2b = 0, 0, min(w, x2a - x1a), min(y2a - y1a, h) + + img4[y1a:y2a, x1a:x2a] = img[y1b:y2b, x1b:x2b] # img4[ymin:ymax, xmin:xmax] + padw = x1a - x1b + padh = y1a - y1b + + # Labels + labels, segments = self.labels[index].copy(), self.segments[index].copy() + if labels.size: + labels[:, 1:] = xywhn2xyxy(labels[:, 1:], w, h, padw, padh) # normalized xywh to pixel xyxy format + segments = [xyn2xy(x, w, h, padw, padh) for x in segments] + labels4.append(labels) + segments4.extend(segments) + + # Concat/clip labels + labels4 = np.concatenate(labels4, 0) + for x in (labels4[:, 1:], *segments4): + np.clip(x, 0, 2 * s, out=x) # clip when using random_perspective() + # img4, labels4 = replicate(img4, labels4) # replicate + + # Augment + img4, labels4, segments4 = copy_paste(img4, labels4, segments4, p=self.hyp['copy_paste']) + img4, labels4 = random_perspective(img4, labels4, segments4, + degrees=self.hyp['degrees'], + translate=self.hyp['translate'], + scale=self.hyp['scale'], + shear=self.hyp['shear'], + perspective=self.hyp['perspective'], + border=self.mosaic_border) # border to remove + + return img4, labels4 + + +def load_mosaic9(self, index): + # 9-mosaic loader. Loads 1 image + 8 random images into a 9-image mosaic + labels9, segments9 = [], [] + s = self.img_size + indices = [index] + random.choices(self.indices, k=8) # 8 additional image indices + random.shuffle(indices) + for i, index in enumerate(indices): + # Load image + img, _, (h, w) = load_image(self, index) + + # place img in img9 + if i == 0: # center + img9 = np.full((s * 3, s * 3, img.shape[2]), 114, dtype=np.uint8) # base image with 4 tiles + h0, w0 = h, w + c = s, s, s + w, s + h # xmin, ymin, xmax, ymax (base) coordinates + elif i == 1: # top + c = s, s - h, s + w, s + elif i == 2: # top right + c = s + wp, s - h, s + wp + w, s + elif i == 3: # right + c = s + w0, s, s + w0 + w, s + h + elif i == 4: # bottom right + c = s + w0, s + hp, s + w0 + w, s + hp + h + elif i == 5: # bottom + c = s + w0 - w, s + h0, s + w0, s + h0 + h + elif i == 6: # bottom left + c = s + w0 - wp - w, s + h0, s + w0 - wp, s + h0 + h + elif i == 7: # left + c = s - w, s + h0 - h, s, s + h0 + elif i == 8: # top left + c = s - w, s + h0 - hp - h, s, s + h0 - hp + + padx, pady = c[:2] + x1, y1, x2, y2 = (max(x, 0) for x in c) # allocate coords + + # Labels + labels, segments = self.labels[index].copy(), self.segments[index].copy() + if labels.size: + labels[:, 1:] = xywhn2xyxy(labels[:, 1:], w, h, padx, pady) # normalized xywh to pixel xyxy format + segments = [xyn2xy(x, w, h, padx, pady) for x in segments] + labels9.append(labels) + segments9.extend(segments) + + # Image + img9[y1:y2, x1:x2] = img[y1 - pady:, x1 - padx:] # img9[ymin:ymax, xmin:xmax] + hp, wp = h, w # height, width previous + + # Offset + yc, xc = (int(random.uniform(0, s)) for _ in self.mosaic_border) # mosaic center x, y + img9 = img9[yc:yc + 2 * s, xc:xc + 2 * s] + + # Concat/clip labels + labels9 = np.concatenate(labels9, 0) + labels9[:, [1, 3]] -= xc + labels9[:, [2, 4]] -= yc + c = np.array([xc, yc]) # centers + segments9 = [x - c for x in segments9] + + for x in (labels9[:, 1:], *segments9): + np.clip(x, 0, 2 * s, out=x) # clip when using random_perspective() + # img9, labels9 = replicate(img9, labels9) # replicate + + # Augment + img9, labels9 = random_perspective(img9, labels9, segments9, + degrees=self.hyp['degrees'], + translate=self.hyp['translate'], + scale=self.hyp['scale'], + shear=self.hyp['shear'], + perspective=self.hyp['perspective'], + border=self.mosaic_border) # border to remove + + return img9, labels9 + + +def create_folder(path='./new'): + # Create folder + if os.path.exists(path): + shutil.rmtree(path) # delete output folder + os.makedirs(path) # make new output folder + + +def flatten_recursive(path='../datasets/coco128'): + # Flatten a recursive directory by bringing all files to top level + new_path = Path(path + '_flat') + create_folder(new_path) + for file in tqdm(glob.glob(str(Path(path)) + '/**/*.*', recursive=True)): + shutil.copyfile(file, new_path / Path(file).name) + + +def extract_boxes(path='../datasets/coco128'): # from utils.datasets import *; extract_boxes() + # Convert detection dataset into classification dataset, with one directory per class + path = Path(path) # images dir + shutil.rmtree(path / 'classifier') if (path / 'classifier').is_dir() else None # remove existing + files = list(path.rglob('*.*')) + n = len(files) # number of files + for im_file in tqdm(files, total=n): + if im_file.suffix[1:] in IMG_FORMATS: + # image + im = cv2.imread(str(im_file))[..., ::-1] # BGR to RGB + h, w = im.shape[:2] + + # labels + lb_file = Path(img2label_paths([str(im_file)])[0]) + if Path(lb_file).exists(): + with open(lb_file) as f: + lb = np.array([x.split() for x in f.read().strip().splitlines()], dtype=np.float32) # labels + + for j, x in enumerate(lb): + c = int(x[0]) # class + f = (path / 'classifier') / f'{c}' / f'{path.stem}_{im_file.stem}_{j}.jpg' # new filename + if not f.parent.is_dir(): + f.parent.mkdir(parents=True) + + b = x[1:] * [w, h, w, h] # box + # b[2:] = b[2:].max() # rectangle to square + b[2:] = b[2:] * 1.2 + 3 # pad + b = xywh2xyxy(b.reshape(-1, 4)).ravel().astype(np.int) + + b[[0, 2]] = np.clip(b[[0, 2]], 0, w) # clip boxes outside of image + b[[1, 3]] = np.clip(b[[1, 3]], 0, h) + assert cv2.imwrite(str(f), im[b[1]:b[3], b[0]:b[2]]), f'box failure in {f}' + + +def autosplit(path='../datasets/coco128/images', weights=(0.9, 0.1, 0.0), annotated_only=False): + """ Autosplit a dataset into train/val/test splits and save path/autosplit_*.txt files + Usage: from utils.datasets import *; autosplit() + Arguments + path: Path to images directory + weights: Train, val, test weights (list, tuple) + annotated_only: Only use images with an annotated txt file + """ + path = Path(path) # images dir + files = sorted(x for x in path.rglob('*.*') if x.suffix[1:].lower() in IMG_FORMATS) # image files only + n = len(files) # number of files + random.seed(0) # for reproducibility + indices = random.choices([0, 1, 2], weights=weights, k=n) # assign each image to a split + + txt = ['autosplit_train.txt', 'autosplit_val.txt', 'autosplit_test.txt'] # 3 txt files + [(path.parent / x).unlink(missing_ok=True) for x in txt] # remove existing + + print(f'Autosplitting images from {path}' + ', using *.txt labeled images only' * annotated_only) + for i, img in tqdm(zip(indices, files), total=n): + if not annotated_only or Path(img2label_paths([str(img)])[0]).exists(): # check label + with open(path.parent / txt[i], 'a') as f: + f.write('./' + img.relative_to(path.parent).as_posix() + '\n') # add image to txt file + + +def verify_image_label(args): + # Verify one image-label pair + im_file, lb_file, prefix = args + nm, nf, ne, nc, msg, segments = 0, 0, 0, 0, '', [] # number (missing, found, empty, corrupt), message, segments + try: + # verify images + im = Image.open(im_file) + im.verify() # PIL verify + shape = exif_size(im) # image size + assert (shape[0] > 9) & (shape[1] > 9), f'image size {shape} <10 pixels' + assert im.format.lower() in IMG_FORMATS, f'invalid image format {im.format}' + if im.format.lower() in ('jpg', 'jpeg'): + with open(im_file, 'rb') as f: + f.seek(-2, 2) + if f.read() != b'\xff\xd9': # corrupt JPEG + ImageOps.exif_transpose(Image.open(im_file)).save(im_file, 'JPEG', subsampling=0, quality=100) + msg = f'{prefix}WARNING: {im_file}: corrupt JPEG restored and saved' + + # verify labels + if os.path.isfile(lb_file): + nf = 1 # label found + with open(lb_file) as f: + l = [x.split() for x in f.read().strip().splitlines() if len(x)] + if any([len(x) > 8 for x in l]): # is segment + classes = np.array([x[0] for x in l], dtype=np.float32) + segments = [np.array(x[1:], dtype=np.float32).reshape(-1, 2) for x in l] # (cls, xy1...) + l = np.concatenate((classes.reshape(-1, 1), segments2boxes(segments)), 1) # (cls, xywh) + l = np.array(l, dtype=np.float32) + nl = len(l) + if nl: + assert l.shape[1] == 5, f'labels require 5 columns, {l.shape[1]} columns detected' + assert (l >= 0).all(), f'negative label values {l[l < 0]}' + assert (l[:, 1:] <= 1).all(), f'non-normalized or out of bounds coordinates {l[:, 1:][l[:, 1:] > 1]}' + _, i = np.unique(l, axis=0, return_index=True) + if len(i) < nl: # duplicate row check + l = l[i] # remove duplicates + if segments: + segments = segments[i] + msg = f'{prefix}WARNING: {im_file}: {nl - len(i)} duplicate labels removed' + else: + ne = 1 # label empty + l = np.zeros((0, 5), dtype=np.float32) + else: + nm = 1 # label missing + l = np.zeros((0, 5), dtype=np.float32) + return im_file, l, shape, segments, nm, nf, ne, nc, msg + except Exception as e: + nc = 1 + msg = f'{prefix}WARNING: {im_file}: ignoring corrupt image/label: {e}' + return [None, None, None, None, nm, nf, ne, nc, msg] + + +def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profile=False, hub=False): + """ Return dataset statistics dictionary with images and instances counts per split per class + To run in parent directory: export PYTHONPATH="$PWD/yolov3" + Usage1: from utils.datasets import *; dataset_stats('coco128.yaml', autodownload=True) + Usage2: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip') + Arguments + path: Path to data.yaml or data.zip (with data.yaml inside data.zip) + autodownload: Attempt to download dataset if not found locally + verbose: Print stats dictionary + """ + + def round_labels(labels): + # Update labels to integer class and 6 decimal place floats + return [[int(c), *(round(x, 4) for x in points)] for c, *points in labels] + + def unzip(path): + # Unzip data.zip TODO: CONSTRAINT: path/to/abc.zip MUST unzip to 'path/to/abc/' + if str(path).endswith('.zip'): # path is data.zip + assert Path(path).is_file(), f'Error unzipping {path}, file not found' + ZipFile(path).extractall(path=path.parent) # unzip + dir = path.with_suffix('') # dataset directory == zip name + return True, str(dir), next(dir.rglob('*.yaml')) # zipped, data_dir, yaml_path + else: # path is data.yaml + return False, None, path + + def hub_ops(f, max_dim=1920): + # HUB ops for 1 image 'f': resize and save at reduced quality in /dataset-hub for web/app viewing + f_new = im_dir / Path(f).name # dataset-hub image filename + try: # use PIL + im = Image.open(f) + r = max_dim / max(im.height, im.width) # ratio + if r < 1.0: # image too large + im = im.resize((int(im.width * r), int(im.height * r))) + im.save(f_new, 'JPEG', quality=75, optimize=True) # save + except Exception as e: # use OpenCV + print(f'WARNING: HUB ops PIL failure {f}: {e}') + im = cv2.imread(f) + im_height, im_width = im.shape[:2] + r = max_dim / max(im_height, im_width) # ratio + if r < 1.0: # image too large + im = cv2.resize(im, (int(im_width * r), int(im_height * r)), interpolation=cv2.INTER_LINEAR) + cv2.imwrite(str(f_new), im) + + zipped, data_dir, yaml_path = unzip(Path(path)) + with open(check_yaml(yaml_path), errors='ignore') as f: + data = yaml.safe_load(f) # data dict + if zipped: + data['path'] = data_dir # TODO: should this be dir.resolve()? + check_dataset(data, autodownload) # download dataset if missing + hub_dir = Path(data['path'] + ('-hub' if hub else '')) + stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary + for split in 'train', 'val', 'test': + if data.get(split) is None: + stats[split] = None # i.e. no test set + continue + x = [] + dataset = LoadImagesAndLabels(data[split]) # load dataset + for label in tqdm(dataset.labels, total=dataset.n, desc='Statistics'): + x.append(np.bincount(label[:, 0].astype(int), minlength=data['nc'])) + x = np.array(x) # shape(128x80) + stats[split] = {'instance_stats': {'total': int(x.sum()), 'per_class': x.sum(0).tolist()}, + 'image_stats': {'total': dataset.n, 'unlabelled': int(np.all(x == 0, 1).sum()), + 'per_class': (x > 0).sum(0).tolist()}, + 'labels': [{str(Path(k).name): round_labels(v.tolist())} for k, v in + zip(dataset.img_files, dataset.labels)]} + + if hub: + im_dir = hub_dir / 'images' + im_dir.mkdir(parents=True, exist_ok=True) + for _ in tqdm(ThreadPool(NUM_THREADS).imap(hub_ops, dataset.img_files), total=dataset.n, desc='HUB Ops'): + pass + + # Profile + stats_path = hub_dir / 'stats.json' + if profile: + for _ in range(1): + file = stats_path.with_suffix('.npy') + t1 = time.time() + np.save(file, stats) + t2 = time.time() + x = np.load(file, allow_pickle=True) + print(f'stats.npy times: {time.time() - t2:.3f}s read, {t2 - t1:.3f}s write') + + file = stats_path.with_suffix('.json') + t1 = time.time() + with open(file, 'w') as f: + json.dump(stats, f) # save stats *.json + t2 = time.time() + with open(file) as f: + x = json.load(f) # load hyps dict + print(f'stats.json times: {time.time() - t2:.3f}s read, {t2 - t1:.3f}s write') + + # Save, print and return + if hub: + print(f'Saving {stats_path.resolve()}...') + with open(stats_path, 'w') as f: + json.dump(stats, f) # save stats.json + if verbose: + print(json.dumps(stats, indent=2, sort_keys=False)) + return stats diff --git a/ros2_ws/src/yolov3/utils/docker/Dockerfile b/yolov3/utils/docker/Dockerfile similarity index 100% rename from ros2_ws/src/yolov3/utils/docker/Dockerfile rename to yolov3/utils/docker/Dockerfile diff --git a/ros2_ws/src/yolov3/utils/docker/Dockerfile-arm64 b/yolov3/utils/docker/Dockerfile-arm64 similarity index 100% rename from ros2_ws/src/yolov3/utils/docker/Dockerfile-arm64 rename to yolov3/utils/docker/Dockerfile-arm64 diff --git a/ros2_ws/src/yolov3/utils/docker/Dockerfile-cpu b/yolov3/utils/docker/Dockerfile-cpu similarity index 100% rename from ros2_ws/src/yolov3/utils/docker/Dockerfile-cpu rename to yolov3/utils/docker/Dockerfile-cpu diff --git a/ros2_ws/src/yolov3/utils/downloads.py b/yolov3/utils/downloads.py similarity index 100% rename from ros2_ws/src/yolov3/utils/downloads.py rename to yolov3/utils/downloads.py diff --git a/ros2_ws/src/yolov3/utils/flask_rest_api/README.md b/yolov3/utils/flask_rest_api/README.md similarity index 100% rename from ros2_ws/src/yolov3/utils/flask_rest_api/README.md rename to yolov3/utils/flask_rest_api/README.md diff --git a/ros2_ws/src/yolov3/utils/flask_rest_api/example_request.py b/yolov3/utils/flask_rest_api/example_request.py similarity index 100% rename from ros2_ws/src/yolov3/utils/flask_rest_api/example_request.py rename to yolov3/utils/flask_rest_api/example_request.py diff --git a/ros2_ws/src/yolov3/utils/flask_rest_api/restapi.py b/yolov3/utils/flask_rest_api/restapi.py similarity index 100% rename from ros2_ws/src/yolov3/utils/flask_rest_api/restapi.py rename to yolov3/utils/flask_rest_api/restapi.py diff --git a/ros2_ws/src/yolov3/utils/general.py b/yolov3/utils/general.py similarity index 100% rename from ros2_ws/src/yolov3/utils/general.py rename to yolov3/utils/general.py diff --git a/ros2_ws/src/yolov3/utils/google_app_engine/Dockerfile b/yolov3/utils/google_app_engine/Dockerfile similarity index 100% rename from ros2_ws/src/yolov3/utils/google_app_engine/Dockerfile rename to yolov3/utils/google_app_engine/Dockerfile diff --git a/ros2_ws/src/yolov3/utils/google_app_engine/additional_requirements.txt b/yolov3/utils/google_app_engine/additional_requirements.txt similarity index 100% rename from ros2_ws/src/yolov3/utils/google_app_engine/additional_requirements.txt rename to yolov3/utils/google_app_engine/additional_requirements.txt diff --git a/ros2_ws/src/yolov3/utils/google_app_engine/app.yaml b/yolov3/utils/google_app_engine/app.yaml similarity index 100% rename from ros2_ws/src/yolov3/utils/google_app_engine/app.yaml rename to yolov3/utils/google_app_engine/app.yaml diff --git a/ros2_ws/src/yolov3/utils/loggers/__init__.py b/yolov3/utils/loggers/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/__init__.py rename to yolov3/utils/loggers/__init__.py diff --git a/ros2_ws/src/yolov3/utils/loggers/clearml/README.md b/yolov3/utils/loggers/clearml/README.md similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/clearml/README.md rename to yolov3/utils/loggers/clearml/README.md diff --git a/ros2_ws/src/yolov3/utils/loggers/clearml/__init__.py b/yolov3/utils/loggers/clearml/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/clearml/__init__.py rename to yolov3/utils/loggers/clearml/__init__.py diff --git a/ros2_ws/src/yolov3/utils/loggers/clearml/clearml_utils.py b/yolov3/utils/loggers/clearml/clearml_utils.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/clearml/clearml_utils.py rename to yolov3/utils/loggers/clearml/clearml_utils.py diff --git a/ros2_ws/src/yolov3/utils/loggers/clearml/hpo.py b/yolov3/utils/loggers/clearml/hpo.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/clearml/hpo.py rename to yolov3/utils/loggers/clearml/hpo.py diff --git a/ros2_ws/src/yolov3/utils/loggers/comet/README.md b/yolov3/utils/loggers/comet/README.md similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/comet/README.md rename to yolov3/utils/loggers/comet/README.md diff --git a/ros2_ws/src/yolov3/utils/loggers/comet/__init__.py b/yolov3/utils/loggers/comet/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/comet/__init__.py rename to yolov3/utils/loggers/comet/__init__.py diff --git a/ros2_ws/src/yolov3/utils/loggers/comet/comet_utils.py b/yolov3/utils/loggers/comet/comet_utils.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/comet/comet_utils.py rename to yolov3/utils/loggers/comet/comet_utils.py diff --git a/ros2_ws/src/yolov3/utils/loggers/comet/hpo.py b/yolov3/utils/loggers/comet/hpo.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/comet/hpo.py rename to yolov3/utils/loggers/comet/hpo.py diff --git a/yolov3/utils/loggers/wandb/README.md b/yolov3/utils/loggers/wandb/README.md new file mode 100644 index 00000000..bae57bda --- /dev/null +++ b/yolov3/utils/loggers/wandb/README.md @@ -0,0 +1,147 @@ +📚 This guide explains how to use **Weights & Biases** (W&B) with YOLOv3 🚀. UPDATED 29 September 2021. +* [About Weights & Biases](#about-weights-&-biases) +* [First-Time Setup](#first-time-setup) +* [Viewing runs](#viewing-runs) +* [Advanced Usage: Dataset Versioning and Evaluation](#advanced-usage) +* [Reports: Share your work with the world!](#reports) + +## About Weights & Biases +Think of [W&B](https://wandb.ai/site?utm_campaign=repo_yolo_wandbtutorial) like GitHub for machine learning models. With a few lines of code, save everything you need to debug, compare and reproduce your models — architecture, hyperparameters, git commits, model weights, GPU usage, and even datasets and predictions. + +Used by top researchers including teams at OpenAI, Lyft, Github, and MILA, W&B is part of the new standard of best practices for machine learning. How W&B can help you optimize your machine learning workflows: + + * [Debug](https://wandb.ai/wandb/getting-started/reports/Visualize-Debug-Machine-Learning-Models--VmlldzoyNzY5MDk#Free-2) model performance in real time + * [GPU usage](https://wandb.ai/wandb/getting-started/reports/Visualize-Debug-Machine-Learning-Models--VmlldzoyNzY5MDk#System-4) visualized automatically + * [Custom charts](https://wandb.ai/wandb/customizable-charts/reports/Powerful-Custom-Charts-To-Debug-Model-Peformance--VmlldzoyNzY4ODI) for powerful, extensible visualization + * [Share insights](https://wandb.ai/wandb/getting-started/reports/Visualize-Debug-Machine-Learning-Models--VmlldzoyNzY5MDk#Share-8) interactively with collaborators + * [Optimize hyperparameters](https://docs.wandb.com/sweeps) efficiently + * [Track](https://docs.wandb.com/artifacts) datasets, pipelines, and production models + +## First-Time Setup +
+ Toggle Details +When you first train, W&B will prompt you to create a new account and will generate an **API key** for you. If you are an existing user you can retrieve your key from https://wandb.ai/authorize. This key is used to tell W&B where to log your data. You only need to supply your key once, and then it is remembered on the same device. + +W&B will create a cloud **project** (default is 'YOLOv3') for your training runs, and each new training run will be provided a unique run **name** within that project as project/name. You can also manually set your project and run name as: + + ```shell + $ python train.py --project ... --name ... + ``` + +YOLOv3 notebook example: Open In Colab Open In Kaggle +Screen Shot 2021-09-29 at 10 23 13 PM + + +
+ +## Viewing Runs +
+ Toggle Details +Run information streams from your environment to the W&B cloud console as you train. This allows you to monitor and even cancel runs in realtime . All important information is logged: + + * Training & Validation losses + * Metrics: Precision, Recall, mAP@0.5, mAP@0.5:0.95 + * Learning Rate over time + * A bounding box debugging panel, showing the training progress over time + * GPU: Type, **GPU Utilization**, power, temperature, **CUDA memory usage** + * System: Disk I/0, CPU utilization, RAM memory usage + * Your trained model as W&B Artifact + * Environment: OS and Python types, Git repository and state, **training command** + +

Weights & Biases dashboard

+ + +
+ +## Advanced Usage +You can leverage W&B artifacts and Tables integration to easily visualize and manage your datasets, models and training evaluations. Here are some quick examples to get you started. +
+

1. Visualize and Version Datasets

+ Log, visualize, dynamically query, and understand your data with W&B Tables. You can use the following command to log your dataset as a W&B Table. This will generate a {dataset}_wandb.yaml file which can be used to train from dataset artifact. +
+ Usage + Code $ python utils/logger/wandb/log_dataset.py --project ... --name ... --data .. + + ![Screenshot (64)](https://user-images.githubusercontent.com/15766192/128486078-d8433890-98a3-4d12-8986-b6c0e3fc64b9.png) +
+ +

2: Train and Log Evaluation simultaneousy

+ This is an extension of the previous section, but it'll also training after uploading the dataset. This also evaluation Table + Evaluation table compares your predictions and ground truths across the validation set for each epoch. It uses the references to the already uploaded datasets, + so no images will be uploaded from your system more than once. +
+ Usage + Code $ python utils/logger/wandb/log_dataset.py --data .. --upload_data + +![Screenshot (72)](https://user-images.githubusercontent.com/15766192/128979739-4cf63aeb-a76f-483f-8861-1c0100b938a5.png) +
+ +

3: Train using dataset artifact

+ When you upload a dataset as described in the first section, you get a new config file with an added `_wandb` to its name. This file contains the information that + can be used to train a model directly from the dataset artifact. This also logs evaluation +
+ Usage + Code $ python utils/logger/wandb/log_dataset.py --data {data}_wandb.yaml + +![Screenshot (72)](https://user-images.githubusercontent.com/15766192/128979739-4cf63aeb-a76f-483f-8861-1c0100b938a5.png) +
+ +

4: Save model checkpoints as artifacts

+ To enable saving and versioning checkpoints of your experiment, pass `--save_period n` with the base cammand, where `n` represents checkpoint interval. + You can also log both the dataset and model checkpoints simultaneously. If not passed, only the final model will be logged + +
+ Usage + Code $ python train.py --save_period 1 + +![Screenshot (68)](https://user-images.githubusercontent.com/15766192/128726138-ec6c1f60-639d-437d-b4ee-3acd9de47ef3.png) +
+ +
+ +

5: Resume runs from checkpoint artifacts.

+Any run can be resumed using artifacts if the --resume argument starts with wandb-artifact:// prefix followed by the run path, i.e, wandb-artifact://username/project/runid . This doesn't require the model checkpoint to be present on the local system. + +
+ Usage + Code $ python train.py --resume wandb-artifact://{run_path} + +![Screenshot (70)](https://user-images.githubusercontent.com/15766192/128728988-4e84b355-6c87-41ae-a591-14aecf45343e.png) +
+ +

6: Resume runs from dataset artifact & checkpoint artifacts.

+ Local dataset or model checkpoints are not required. This can be used to resume runs directly on a different device + The syntax is same as the previous section, but you'll need to lof both the dataset and model checkpoints as artifacts, i.e, set bot --upload_dataset or + train from _wandb.yaml file and set --save_period + +
+ Usage + Code $ python train.py --resume wandb-artifact://{run_path} + +![Screenshot (70)](https://user-images.githubusercontent.com/15766192/128728988-4e84b355-6c87-41ae-a591-14aecf45343e.png) +
+ + + + +

Reports

+W&B Reports can be created from your saved runs for sharing online. Once a report is created you will receive a link you can use to publically share your results. Here is an example report created from the COCO128 tutorial trainings of all YOLOv5 models ([link](https://wandb.ai/glenn-jocher/yolov5_tutorial/reports/YOLOv5-COCO128-Tutorial-Results--VmlldzozMDI5OTY)). + +Weights & Biases Reports + + +## Environments + +YOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including [CUDA](https://developer.nvidia.com/cuda)/[CUDNN](https://developer.nvidia.com/cudnn), [Python](https://www.python.org/) and [PyTorch](https://pytorch.org/) preinstalled): + +- **Google Colab and Kaggle** notebooks with free GPU: Open In Colab Open In Kaggle +- **Google Cloud** Deep Learning VM. See [GCP Quickstart Guide](https://github.com/ultralytics/yolov3/wiki/GCP-Quickstart) +- **Amazon** Deep Learning AMI. See [AWS Quickstart Guide](https://github.com/ultralytics/yolov3/wiki/AWS-Quickstart) +- **Docker Image**. See [Docker Quickstart Guide](https://github.com/ultralytics/yolov3/wiki/Docker-Quickstart) Docker Pulls + + +## Status + +![CI CPU testing](https://github.com/ultralytics/yolov3/workflows/CI%20CPU%20testing/badge.svg) + +If this badge is green, all [YOLOv3 GitHub Actions](https://github.com/ultralytics/yolov3/actions) Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training ([train.py](https://github.com/ultralytics/yolov3/blob/master/train.py)), validation ([val.py](https://github.com/ultralytics/yolov3/blob/master/val.py)), inference ([detect.py](https://github.com/ultralytics/yolov3/blob/master/detect.py)) and export ([export.py](https://github.com/ultralytics/yolov3/blob/master/export.py)) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. diff --git a/ros2_ws/src/yolov3/utils/loggers/wandb/__init__.py b/yolov3/utils/loggers/wandb/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/wandb/__init__.py rename to yolov3/utils/loggers/wandb/__init__.py diff --git a/yolov3/utils/loggers/wandb/log_dataset.py b/yolov3/utils/loggers/wandb/log_dataset.py new file mode 100644 index 00000000..d3c77430 --- /dev/null +++ b/yolov3/utils/loggers/wandb/log_dataset.py @@ -0,0 +1,27 @@ +import argparse + +from wandb_utils import WandbLogger + +from utils.general import LOGGER + +WANDB_ARTIFACT_PREFIX = 'wandb-artifact://' + + +def create_dataset_artifact(opt): + logger = WandbLogger(opt, None, job_type='Dataset Creation') # TODO: return value unused + if not logger.wandb: + LOGGER.info("install wandb using `pip install wandb` to log the dataset") + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--data', type=str, default='data/coco128.yaml', help='data.yaml path') + parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset') + parser.add_argument('--project', type=str, default='YOLOv3', help='name of W&B Project') + parser.add_argument('--entity', default=None, help='W&B entity') + parser.add_argument('--name', type=str, default='log dataset', help='name of W&B run') + + opt = parser.parse_args() + opt.resume = False # Explicitly disallow resume check for dataset upload job + + create_dataset_artifact(opt) diff --git a/yolov3/utils/loggers/wandb/sweep.py b/yolov3/utils/loggers/wandb/sweep.py new file mode 100644 index 00000000..5e24f96e --- /dev/null +++ b/yolov3/utils/loggers/wandb/sweep.py @@ -0,0 +1,41 @@ +import sys +from pathlib import Path + +import wandb + +FILE = Path(__file__).resolve() +ROOT = FILE.parents[3] # root directory +if str(ROOT) not in sys.path: + sys.path.append(str(ROOT)) # add ROOT to PATH + +from train import parse_opt, train +from utils.callbacks import Callbacks +from utils.general import increment_path +from utils.torch_utils import select_device + + +def sweep(): + wandb.init() + # Get hyp dict from sweep agent + hyp_dict = vars(wandb.config).get("_items") + + # Workaround: get necessary opt args + opt = parse_opt(known=True) + opt.batch_size = hyp_dict.get("batch_size") + opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok or opt.evolve)) + opt.epochs = hyp_dict.get("epochs") + opt.nosave = True + opt.data = hyp_dict.get("data") + opt.weights = str(opt.weights) + opt.cfg = str(opt.cfg) + opt.data = str(opt.data) + opt.hyp = str(opt.hyp) + opt.project = str(opt.project) + device = select_device(opt.device, batch_size=opt.batch_size) + + # train + train(hyp_dict, opt, device, callbacks=Callbacks()) + + +if __name__ == "__main__": + sweep() diff --git a/yolov3/utils/loggers/wandb/sweep.yaml b/yolov3/utils/loggers/wandb/sweep.yaml new file mode 100644 index 00000000..c7790d75 --- /dev/null +++ b/yolov3/utils/loggers/wandb/sweep.yaml @@ -0,0 +1,143 @@ +# Hyperparameters for training +# To set range- +# Provide min and max values as: +# parameter: +# +# min: scalar +# max: scalar +# OR +# +# Set a specific list of search space- +# parameter: +# values: [scalar1, scalar2, scalar3...] +# +# You can use grid, bayesian and hyperopt search strategy +# For more info on configuring sweeps visit - https://docs.wandb.ai/guides/sweeps/configuration + +program: utils/loggers/wandb/sweep.py +method: random +metric: + name: metrics/mAP_0.5 + goal: maximize + +parameters: + # hyperparameters: set either min, max range or values list + data: + value: "data/coco128.yaml" + batch_size: + values: [64] + epochs: + values: [10] + + lr0: + distribution: uniform + min: 1e-5 + max: 1e-1 + lrf: + distribution: uniform + min: 0.01 + max: 1.0 + momentum: + distribution: uniform + min: 0.6 + max: 0.98 + weight_decay: + distribution: uniform + min: 0.0 + max: 0.001 + warmup_epochs: + distribution: uniform + min: 0.0 + max: 5.0 + warmup_momentum: + distribution: uniform + min: 0.0 + max: 0.95 + warmup_bias_lr: + distribution: uniform + min: 0.0 + max: 0.2 + box: + distribution: uniform + min: 0.02 + max: 0.2 + cls: + distribution: uniform + min: 0.2 + max: 4.0 + cls_pw: + distribution: uniform + min: 0.5 + max: 2.0 + obj: + distribution: uniform + min: 0.2 + max: 4.0 + obj_pw: + distribution: uniform + min: 0.5 + max: 2.0 + iou_t: + distribution: uniform + min: 0.1 + max: 0.7 + anchor_t: + distribution: uniform + min: 2.0 + max: 8.0 + fl_gamma: + distribution: uniform + min: 0.0 + max: 0.1 + hsv_h: + distribution: uniform + min: 0.0 + max: 0.1 + hsv_s: + distribution: uniform + min: 0.0 + max: 0.9 + hsv_v: + distribution: uniform + min: 0.0 + max: 0.9 + degrees: + distribution: uniform + min: 0.0 + max: 45.0 + translate: + distribution: uniform + min: 0.0 + max: 0.9 + scale: + distribution: uniform + min: 0.0 + max: 0.9 + shear: + distribution: uniform + min: 0.0 + max: 10.0 + perspective: + distribution: uniform + min: 0.0 + max: 0.001 + flipud: + distribution: uniform + min: 0.0 + max: 1.0 + fliplr: + distribution: uniform + min: 0.0 + max: 1.0 + mosaic: + distribution: uniform + min: 0.0 + max: 1.0 + mixup: + distribution: uniform + min: 0.0 + max: 1.0 + copy_paste: + distribution: uniform + min: 0.0 + max: 1.0 diff --git a/ros2_ws/src/yolov3/utils/loggers/wandb/wandb_utils.py b/yolov3/utils/loggers/wandb/wandb_utils.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loggers/wandb/wandb_utils.py rename to yolov3/utils/loggers/wandb/wandb_utils.py diff --git a/ros2_ws/src/yolov3/utils/loss.py b/yolov3/utils/loss.py similarity index 100% rename from ros2_ws/src/yolov3/utils/loss.py rename to yolov3/utils/loss.py diff --git a/ros2_ws/src/yolov3/utils/metrics.py b/yolov3/utils/metrics.py similarity index 100% rename from ros2_ws/src/yolov3/utils/metrics.py rename to yolov3/utils/metrics.py diff --git a/ros2_ws/src/yolov3/utils/plots.py b/yolov3/utils/plots.py similarity index 100% rename from ros2_ws/src/yolov3/utils/plots.py rename to yolov3/utils/plots.py diff --git a/ros2_ws/src/yolov3/utils/segment/__init__.py b/yolov3/utils/segment/__init__.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/__init__.py rename to yolov3/utils/segment/__init__.py diff --git a/ros2_ws/src/yolov3/utils/segment/augmentations.py b/yolov3/utils/segment/augmentations.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/augmentations.py rename to yolov3/utils/segment/augmentations.py diff --git a/ros2_ws/src/yolov3/utils/segment/dataloaders.py b/yolov3/utils/segment/dataloaders.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/dataloaders.py rename to yolov3/utils/segment/dataloaders.py diff --git a/ros2_ws/src/yolov3/utils/segment/general.py b/yolov3/utils/segment/general.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/general.py rename to yolov3/utils/segment/general.py diff --git a/ros2_ws/src/yolov3/utils/segment/loss.py b/yolov3/utils/segment/loss.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/loss.py rename to yolov3/utils/segment/loss.py diff --git a/ros2_ws/src/yolov3/utils/segment/metrics.py b/yolov3/utils/segment/metrics.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/metrics.py rename to yolov3/utils/segment/metrics.py diff --git a/ros2_ws/src/yolov3/utils/segment/plots.py b/yolov3/utils/segment/plots.py similarity index 100% rename from ros2_ws/src/yolov3/utils/segment/plots.py rename to yolov3/utils/segment/plots.py diff --git a/ros2_ws/src/yolov3/utils/torch_utils.py b/yolov3/utils/torch_utils.py similarity index 100% rename from ros2_ws/src/yolov3/utils/torch_utils.py rename to yolov3/utils/torch_utils.py diff --git a/ros2_ws/src/yolov3/utils/triton.py b/yolov3/utils/triton.py similarity index 100% rename from ros2_ws/src/yolov3/utils/triton.py rename to yolov3/utils/triton.py diff --git a/ros2_ws/src/yolov3/val.py b/yolov3/val.py similarity index 100% rename from ros2_ws/src/yolov3/val.py rename to yolov3/val.py