diff --git a/005yolov8预测.py b/005yolov8预测.py new file mode 100644 index 0000000..2f02f8b --- /dev/null +++ b/005yolov8预测.py @@ -0,0 +1,40 @@ +import os.path + +from ultralytics import YOLO + +''' + 注意修改配置文件中的文件夹路径 +''' + + +model = YOLO('/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819/train2/weights/best.pt') + +images_path = '/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819/train/images' +save_path = '/home/admin-root/haotian/康达瑞贝斯机器狗/output' + +all_images = [os.path.join(images_path, t) for t in os.listdir(images_path)] + + +for i in range(len(all_images)): + + # conf 置信度在. + results = model(all_images[i], + conf = 0.2, device=0) + + # # Process results list + # = 0 + # for result in results: + # boxes = result.boxes # Boxes object for bounding box outputs + # # masks = result.masks # Masks object for segmentation masks outputs + # # keypoints = result.keypoints # Keypoints object for pose outputs + + # # 属于这个类的置信度 + # probs = result.probs # Probs object for classification outputs + # # obb = result.obb # Oriented boxes object for OBB outputs + # print(boxes,' ',probs) + # # result.show() # display to screen + results[0].save(filename=f"{save_path}/result_{i}.jpg") # save to disk + # i += 1 + + if i == 20: + break \ No newline at end of file diff --git a/YoloV8Obj/006yolov8训练_1.py b/YoloV8Obj/006yolov8训练_1.py new file mode 100644 index 0000000..36f45da --- /dev/null +++ b/YoloV8Obj/006yolov8训练_1.py @@ -0,0 +1,20 @@ +from ultralytics import YOLO +import torch + + + +if __name__ == '__main__': + + + + ''' + 加载在HelmetHead中训练的模型, 在HelmetShowHead数据集上继续训练 + ''' + + + model = YOLO('/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/models/yolov8n.pt') + + results = model.train(data='/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819.yaml', epochs=200, batch=32, patience=20, imgsz=640, save=True, + workers=2, device=0, project='dataset_20250819', name='train', verbose=True) + +# print(model) \ No newline at end of file diff --git a/YoloV8Obj/dataset_20250819.yaml b/YoloV8Obj/dataset_20250819.yaml new file mode 100644 index 0000000..a93f763 --- /dev/null +++ b/YoloV8Obj/dataset_20250819.yaml @@ -0,0 +1,21 @@ +# Ultralytics YOLO 🚀, AGPL-3.0 license +# COCO8 dataset (first 8 images from COCO train2017) by Ultralytics +# Documentation: https://docs.ultralytics.com/datasets/detect/coco8/ +# Example usage: yolo train data=coco8.yaml +# parent +# ├── ultralytics +# └── datasets +# └── coco8 ← downloads here (1 MB) + +# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] +path: /home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819 # dataset root dir +train: train # train images (relative to 'path') 4 images +val: train # val images (relative to 'path') 4 images +test: # test images (optional) + +# Classes +names: + 0: extinguisher + 1: other + +# ['Gloves','Helmet','Non-Helmet','Person','Shoes','Vest','bare-arms'] \ No newline at end of file diff --git a/YoloV8Obj/dataset_20250819/train/labels.cache b/YoloV8Obj/dataset_20250819/train/labels.cache new file mode 100644 index 0000000..9c216fd Binary files /dev/null and b/YoloV8Obj/dataset_20250819/train/labels.cache differ diff --git a/YoloV8Obj/dataset_20250819/train2/args.yaml b/YoloV8Obj/dataset_20250819/train2/args.yaml new file mode 100644 index 0000000..4bf5149 --- /dev/null +++ b/YoloV8Obj/dataset_20250819/train2/args.yaml @@ -0,0 +1,105 @@ +task: detect +mode: train +model: /home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/models/yolov8n.pt +data: /home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819.yaml +epochs: 200 +time: null +patience: 20 +batch: 32 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: '0' +workers: 2 +project: dataset_20250819 +name: train2 +exist_ok: false +pretrained: true +optimizer: auto +verbose: true +seed: 0 +deterministic: true +single_cls: false +rect: false +cos_lr: false +close_mosaic: 10 +resume: false +amp: true +fraction: 1.0 +profile: false +freeze: null +multi_scale: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +agnostic_nms: false +classes: null +retina_masks: false +embed: null +show: false +save_frames: false +save_txt: false +save_conf: false +save_crop: false +show_labels: true +show_conf: true +show_boxes: true +line_width: null +format: torchscript +keras: false +optimize: false +int8: false +dynamic: false +simplify: true +opset: null +workspace: null +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +nbs: 64 +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 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +cutmix: 0.0 +copy_paste: 0.0 +copy_paste_mode: flip +auto_augment: randaugment +erasing: 0.4 +cfg: null +tracker: botsort.yaml +save_dir: dataset_20250819/train2 diff --git a/YoloV8Obj/dataset_20250819/train2/results.csv b/YoloV8Obj/dataset_20250819/train2/results.csv new file mode 100644 index 0000000..32eccb9 --- /dev/null +++ b/YoloV8Obj/dataset_20250819/train2/results.csv @@ -0,0 +1,201 @@ +epoch,time,train/box_loss,train/cls_loss,train/dfl_loss,metrics/precision(B),metrics/recall(B),metrics/mAP50(B),metrics/mAP50-95(B),val/box_loss,val/cls_loss,val/dfl_loss,lr/pg0,lr/pg1,lr/pg2 +1,27.3668,1.27376,2.68853,1.28066,0.9076,0.57576,0.72854,0.50843,1.06469,2.36794,1.12911,0.000546847,0.000546847,0.000546847 +2,50.1188,1.17904,1.69909,1.20956,0.85243,0.79337,0.86667,0.59052,1.16647,1.51113,1.27141,0.00109706,0.00109706,0.00109706 +3,73.0336,1.15993,1.35687,1.20332,0.64039,0.69146,0.79127,0.49553,1.21529,3.39843,1.27992,0.00164176,0.00164176,0.00164176 +4,95.0828,1.16607,1.15181,1.19897,0.60093,0.66208,0.6443,0.40661,1.20133,2.63417,1.2296,0.00164225,0.00164225,0.00164225 +5,116.047,1.11982,0.96875,1.19619,0.83824,0.8179,0.87044,0.6062,1.16601,1.3436,1.2065,0.00163399,0.00163399,0.00163399 +6,138.19,1.07761,0.87998,1.15891,0.92398,0.86169,0.95423,0.66311,1.02875,0.84063,1.10258,0.00162574,0.00162574,0.00162574 +7,160.488,1.10298,0.83168,1.18162,0.88229,0.93527,0.95978,0.6965,0.99512,0.83165,1.12269,0.00161749,0.00161749,0.00161749 +8,185.883,1.06857,0.80009,1.15897,0.86043,0.97148,0.97512,0.71471,0.98695,0.89476,1.11201,0.00160924,0.00160924,0.00160924 +9,205.523,1.06519,0.80408,1.16286,0.94327,0.91657,0.95787,0.69726,1.00047,0.7071,1.10611,0.00160099,0.00160099,0.00160099 +10,227.885,1.00432,0.71279,1.12971,0.95434,0.92703,0.97524,0.68002,0.97152,0.68198,1.10221,0.00159274,0.00159274,0.00159274 +11,249.936,1.01258,0.70703,1.12994,0.88924,0.88068,0.94415,0.64542,0.98838,0.7049,1.11713,0.00158448,0.00158448,0.00158448 +12,268.155,1.00368,0.67736,1.12676,0.94652,0.957,0.98165,0.72213,0.91137,0.59215,1.06467,0.00157623,0.00157623,0.00157623 +13,290.022,1.01424,0.69772,1.12939,0.96144,0.9384,0.98053,0.7293,0.93675,0.59535,1.04708,0.00156798,0.00156798,0.00156798 +14,311.881,0.99093,0.66108,1.12532,0.95467,0.95299,0.97851,0.73781,0.89565,0.81476,1.05996,0.00155973,0.00155973,0.00155973 +15,335.827,0.95983,0.62759,1.10607,0.95533,0.97126,0.98489,0.74117,0.89683,0.53361,1.04004,0.00155148,0.00155148,0.00155148 +16,360.793,0.98456,0.64935,1.11545,0.9537,0.94596,0.97571,0.73816,0.89096,0.58484,1.04423,0.00154323,0.00154323,0.00154323 +17,385.684,0.97959,0.62486,1.11249,0.93962,0.94842,0.9803,0.73287,0.91827,0.55077,1.08985,0.00153497,0.00153497,0.00153497 +18,407.996,0.97197,0.62014,1.11678,0.94268,0.96506,0.98195,0.75738,0.87081,0.56622,1.03804,0.00152672,0.00152672,0.00152672 +19,428.984,0.96652,0.62415,1.1063,0.95356,0.96057,0.98116,0.74774,0.87197,0.55148,1.03683,0.00151847,0.00151847,0.00151847 +20,445.11,0.94284,0.61154,1.09249,0.96625,0.96245,0.98242,0.75286,0.86941,0.57396,1.01375,0.00151022,0.00151022,0.00151022 +21,460.902,0.95765,0.60885,1.10862,0.93911,0.96718,0.98222,0.74499,0.90421,0.52835,1.06993,0.00150197,0.00150197,0.00150197 +22,476.415,0.94437,0.61156,1.09145,0.97299,0.96056,0.98931,0.7615,0.85366,0.50855,1.03678,0.00149372,0.00149372,0.00149372 +23,495.736,0.94375,0.58867,1.10432,0.94814,0.91877,0.96025,0.71809,0.9047,0.93131,1.06126,0.00148546,0.00148546,0.00148546 +24,517.403,0.92387,0.57321,1.09563,0.96599,0.96783,0.98732,0.7577,0.86776,0.50259,1.03674,0.00147721,0.00147721,0.00147721 +25,542.354,0.91839,0.58194,1.08847,0.97873,0.93,0.97527,0.74672,0.87438,0.64392,1.03516,0.00146896,0.00146896,0.00146896 +26,558.802,0.92138,0.55521,1.08572,0.96526,0.98229,0.98884,0.76382,0.85302,0.44908,1.0171,0.00146071,0.00146071,0.00146071 +27,578.075,0.92218,0.56868,1.09215,0.97197,0.96171,0.98883,0.75083,0.87288,0.4653,1.02715,0.00145246,0.00145246,0.00145246 +28,597.376,0.92503,0.56547,1.08829,0.97248,0.97743,0.98824,0.773,0.83233,0.47584,1.00668,0.00144421,0.00144421,0.00144421 +29,614.329,0.9244,0.54689,1.08705,0.96776,0.98314,0.98927,0.75793,0.84501,0.45077,1.02212,0.00143595,0.00143595,0.00143595 +30,632.174,0.89706,0.54788,1.08549,0.96137,0.97879,0.98984,0.78058,0.79774,0.44099,1.00111,0.0014277,0.0014277,0.0014277 +31,650.789,0.9002,0.55554,1.06899,0.96769,0.98133,0.99072,0.7652,0.82946,0.45411,1.00595,0.00141945,0.00141945,0.00141945 +32,670.026,0.90833,0.53809,1.07772,0.96252,0.98118,0.98836,0.7661,0.83298,0.44133,1.02554,0.0014112,0.0014112,0.0014112 +33,685.438,0.90893,0.54193,1.08521,0.97271,0.98556,0.9902,0.76671,0.83035,0.43814,0.99947,0.00140295,0.00140295,0.00140295 +34,709.674,0.8907,0.51456,1.07064,0.97374,0.97811,0.98869,0.78186,0.79884,0.41473,1.00326,0.0013947,0.0013947,0.0013947 +35,734.195,0.90201,0.53665,1.07612,0.97757,0.97266,0.98934,0.78951,0.81122,0.42612,0.9964,0.00138644,0.00138644,0.00138644 +36,752.151,0.87639,0.52432,1.06421,0.96348,0.98293,0.98786,0.77379,0.78856,0.44553,0.9866,0.00137819,0.00137819,0.00137819 +37,775.951,0.86589,0.51327,1.0576,0.98016,0.97256,0.99136,0.77991,0.82013,0.42197,1.00143,0.00136994,0.00136994,0.00136994 +38,798.714,0.88759,0.5197,1.06977,0.96869,0.98673,0.9885,0.78217,0.80243,0.40864,1.01099,0.00136169,0.00136169,0.00136169 +39,823.836,0.88383,0.51726,1.06726,0.97528,0.98446,0.9902,0.79535,0.77786,0.40035,0.98086,0.00135344,0.00135344,0.00135344 +40,846.194,0.89638,0.52223,1.08072,0.96348,0.98603,0.98904,0.80025,0.77474,0.40305,0.99009,0.00134519,0.00134519,0.00134519 +41,867.201,0.87137,0.50836,1.07419,0.97073,0.98324,0.99164,0.78661,0.78322,0.39273,1.00329,0.00133693,0.00133693,0.00133693 +42,889.717,0.88009,0.4965,1.07172,0.97176,0.95409,0.98354,0.78358,0.80043,0.46658,1.0107,0.00132868,0.00132868,0.00132868 +43,907.22,0.86674,0.50767,1.07658,0.97086,0.99041,0.98901,0.79661,0.76083,0.42724,0.98132,0.00132043,0.00132043,0.00132043 +44,928.766,0.86919,0.48842,1.06249,0.97258,0.981,0.98967,0.79702,0.77516,0.39731,0.99561,0.00131218,0.00131218,0.00131218 +45,945.042,0.85782,0.4942,1.06471,0.95918,0.99176,0.99043,0.79192,0.76602,0.41573,0.98085,0.00130393,0.00130393,0.00130393 +46,967.005,0.87191,0.49115,1.07151,0.97429,0.98898,0.99103,0.79338,0.78012,0.39666,1.00884,0.00129568,0.00129568,0.00129568 +47,991.424,0.85171,0.49617,1.06028,0.96791,0.98226,0.99151,0.77898,0.79518,0.40399,0.98438,0.00128742,0.00128742,0.00128742 +48,1008.14,0.86678,0.50222,1.06938,0.97405,0.9826,0.99011,0.79557,0.7806,0.38892,0.98886,0.00127917,0.00127917,0.00127917 +49,1028.63,0.86204,0.48155,1.05359,0.97475,0.98993,0.98995,0.78989,0.75963,0.38532,0.97276,0.00127092,0.00127092,0.00127092 +50,1053.15,0.84676,0.4814,1.04672,0.97596,0.98433,0.99147,0.78436,0.7879,0.40904,0.99944,0.00126267,0.00126267,0.00126267 +51,1077.09,0.85037,0.47636,1.0467,0.97407,0.98611,0.99015,0.80937,0.74886,0.37707,0.96565,0.00125442,0.00125442,0.00125442 +52,1100.68,0.85108,0.48933,1.04998,0.98038,0.98375,0.99147,0.80226,0.74833,0.36362,0.96964,0.00124617,0.00124617,0.00124617 +53,1119.09,0.84939,0.47183,1.04612,0.97851,0.97779,0.99121,0.79841,0.75516,0.39002,0.96647,0.00123791,0.00123791,0.00123791 +54,1140.43,0.84231,0.47227,1.05331,0.97469,0.98152,0.991,0.79107,0.76079,0.39455,0.98938,0.00122966,0.00122966,0.00122966 +55,1164.02,0.84326,0.46593,1.05107,0.98269,0.98129,0.99007,0.80557,0.75393,0.37108,0.98445,0.00122141,0.00122141,0.00122141 +56,1188.65,0.83515,0.46205,1.04935,0.97322,0.99068,0.98987,0.79761,0.75297,0.37553,0.98086,0.00121316,0.00121316,0.00121316 +57,1209.44,0.83663,0.46622,1.05446,0.96983,0.99078,0.99123,0.79865,0.75639,0.3716,0.97477,0.00120491,0.00120491,0.00120491 +58,1228.81,0.83897,0.46323,1.04592,0.97764,0.98917,0.99251,0.80435,0.73807,0.3745,0.95842,0.00119666,0.00119666,0.00119666 +59,1249.29,0.83926,0.46639,1.03968,0.9748,0.98071,0.99112,0.79515,0.76468,0.3812,0.96617,0.0011884,0.0011884,0.0011884 +60,1264.61,0.8363,0.46588,1.04466,0.9768,0.98885,0.99264,0.79495,0.75304,0.37349,0.96861,0.00118015,0.00118015,0.00118015 +61,1283.3,0.84709,0.46382,1.06029,0.97079,0.99322,0.99164,0.81111,0.73347,0.37517,0.99167,0.0011719,0.0011719,0.0011719 +62,1298.72,0.83504,0.4658,1.05433,0.97091,0.98276,0.99115,0.80424,0.74086,0.37338,0.97908,0.00116365,0.00116365,0.00116365 +63,1314.14,0.83129,0.46221,1.04628,0.97988,0.98974,0.99151,0.80875,0.73241,0.35366,0.96954,0.0011554,0.0011554,0.0011554 +64,1329.82,0.83164,0.46812,1.04071,0.981,0.98582,0.99225,0.81475,0.739,0.35898,0.97135,0.00114715,0.00114715,0.00114715 +65,1345.16,0.81304,0.44574,1.03971,0.97034,0.99218,0.99014,0.80366,0.75253,0.35558,0.96104,0.00113889,0.00113889,0.00113889 +66,1364.79,0.8216,0.44894,1.04157,0.97748,0.99445,0.99316,0.81551,0.74237,0.34993,0.94946,0.00113064,0.00113064,0.00113064 +67,1386.81,0.80912,0.44414,1.03604,0.97936,0.99058,0.99185,0.79921,0.74404,0.35934,0.94683,0.00112239,0.00112239,0.00112239 +68,1409.14,0.80785,0.44405,1.03584,0.97931,0.98802,0.99265,0.81476,0.71993,0.35084,0.9509,0.00111414,0.00111414,0.00111414 +69,1431.44,0.82224,0.43652,1.03498,0.97648,0.98389,0.99108,0.81368,0.72433,0.36356,0.95901,0.00110589,0.00110589,0.00110589 +70,1454.88,0.83365,0.46072,1.04194,0.98288,0.98927,0.99196,0.80549,0.74891,0.36202,0.9666,0.00109764,0.00109764,0.00109764 +71,1479.23,0.81278,0.44626,1.03022,0.96402,0.99399,0.99147,0.81091,0.72605,0.35967,0.95708,0.00108938,0.00108938,0.00108938 +72,1504.29,0.81151,0.43928,1.03706,0.97533,0.99553,0.99262,0.804,0.7393,0.34665,0.97264,0.00108113,0.00108113,0.00108113 +73,1528.21,0.81249,0.44438,1.03083,0.97593,0.99007,0.99253,0.80863,0.7337,0.3499,0.95339,0.00107288,0.00107288,0.00107288 +74,1553.07,0.81961,0.45539,1.04666,0.98663,0.9891,0.99233,0.81744,0.71675,0.34607,0.96797,0.00106463,0.00106463,0.00106463 +75,1577.14,0.79662,0.43798,1.02825,0.97446,0.99135,0.99227,0.8168,0.71669,0.34102,0.96515,0.00105638,0.00105638,0.00105638 +76,1592.56,0.79507,0.42313,1.03229,0.9752,0.99279,0.9911,0.82055,0.71733,0.34023,0.95344,0.00104813,0.00104813,0.00104813 +77,1613.9,0.80322,0.4418,1.02639,0.98073,0.99142,0.99279,0.81132,0.73145,0.34651,0.95558,0.00103987,0.00103987,0.00103987 +78,1635.89,0.80736,0.42225,1.03277,0.98244,0.99362,0.99284,0.82133,0.70537,0.3341,0.94236,0.00103162,0.00103162,0.00103162 +79,1653.39,0.79012,0.42005,1.02659,0.98209,0.99064,0.99273,0.81241,0.73467,0.35157,0.94743,0.00102337,0.00102337,0.00102337 +80,1677,0.81877,0.43559,1.03293,0.97768,0.9937,0.99197,0.81562,0.71527,0.33915,0.94724,0.00101512,0.00101512,0.00101512 +81,1699.08,0.79882,0.42965,1.03174,0.96936,0.99503,0.99087,0.81573,0.73252,0.34254,0.95923,0.00100687,0.00100687,0.00100687 +82,1721.36,0.7875,0.41506,1.02183,0.9842,0.98884,0.99181,0.82807,0.71599,0.32628,0.94877,0.000998616,0.000998616,0.000998616 +83,1739.85,0.81329,0.43637,1.03369,0.97775,0.99266,0.99336,0.8198,0.71803,0.34364,0.9585,0.000990365,0.000990365,0.000990365 +84,1758.67,0.79157,0.42818,1.0322,0.97847,0.99505,0.99318,0.80747,0.72155,0.34434,0.95795,0.000982113,0.000982113,0.000982113 +85,1780.77,0.78526,0.41858,1.02384,0.97853,0.99553,0.99236,0.82467,0.6985,0.32807,0.94068,0.000973861,0.000973861,0.000973861 +86,1802.81,0.78919,0.42037,1.01593,0.97638,0.99601,0.99278,0.8194,0.69306,0.32887,0.94705,0.00096561,0.00096561,0.00096561 +87,1825.06,0.77929,0.43286,1.02386,0.9825,0.99024,0.99189,0.82002,0.70099,0.33189,0.95033,0.000957358,0.000957358,0.000957358 +88,1847.46,0.77969,0.41549,1.02218,0.97412,0.99398,0.99311,0.82473,0.69873,0.32554,0.94144,0.000949106,0.000949106,0.000949106 +89,1869.53,0.79617,0.43824,1.01939,0.97854,0.99505,0.99234,0.82464,0.69716,0.33341,0.94157,0.000940855,0.000940855,0.000940855 +90,1892.32,0.78989,0.41351,1.01984,0.98448,0.99343,0.99293,0.81824,0.70764,0.33152,0.94885,0.000932603,0.000932603,0.000932603 +91,1916.82,0.78554,0.41458,1.01952,0.9788,0.99505,0.99292,0.82954,0.69341,0.3163,0.93592,0.000924352,0.000924352,0.000924352 +92,1941.39,0.7872,0.41672,1.01206,0.97743,0.99553,0.99152,0.82688,0.69759,0.32539,0.92983,0.0009161,0.0009161,0.0009161 +93,1963.36,0.7846,0.40583,1.01691,0.98298,0.99457,0.99233,0.82107,0.695,0.32183,0.94472,0.000907848,0.000907848,0.000907848 +94,1978.57,0.77355,0.40786,1.02341,0.98652,0.9901,0.99297,0.82111,0.69453,0.32052,0.94513,0.000899597,0.000899597,0.000899597 +95,1996.8,0.7923,0.4151,1.0338,0.97983,0.98704,0.99203,0.82881,0.68956,0.31775,0.93478,0.000891345,0.000891345,0.000891345 +96,2018.8,0.78003,0.41677,1.02514,0.98543,0.99154,0.99284,0.83143,0.6808,0.31562,0.9382,0.000883093,0.000883093,0.000883093 +97,2041.21,0.78419,0.41449,1.02236,0.98889,0.99192,0.9922,0.82032,0.70917,0.32549,0.95597,0.000874842,0.000874842,0.000874842 +98,2063.5,0.77246,0.40438,1.01714,0.98625,0.98639,0.99374,0.8278,0.67835,0.31225,0.93132,0.00086659,0.00086659,0.00086659 +99,2085.57,0.75966,0.40864,1.0104,0.98992,0.98019,0.99179,0.82021,0.68751,0.31819,0.96179,0.000858338,0.000858338,0.000858338 +100,2106.92,0.76888,0.41298,1.01852,0.98339,0.99218,0.99268,0.83335,0.68012,0.31601,0.9319,0.000850087,0.000850087,0.000850087 +101,2130.48,0.77503,0.40577,1.01516,0.98938,0.98616,0.99285,0.81953,0.69011,0.32481,0.94885,0.000841835,0.000841835,0.000841835 +102,2150.11,0.75133,0.40174,1.004,0.99142,0.97793,0.99328,0.83194,0.67427,0.31301,0.93958,0.000833583,0.000833583,0.000833583 +103,2172.2,0.76795,0.39905,1.01888,0.97998,0.99232,0.99305,0.8308,0.67569,0.31414,0.94401,0.000825332,0.000825332,0.000825332 +104,2193.55,0.7555,0.3956,1.00661,0.98142,0.99615,0.99303,0.8303,0.66925,0.30377,0.93155,0.00081708,0.00081708,0.00081708 +105,2215.36,0.7759,0.41043,1.01821,0.9903,0.99342,0.99236,0.83399,0.67661,0.31199,0.94671,0.000808828,0.000808828,0.000808828 +106,2237.11,0.75882,0.40643,1.02545,0.98624,0.99452,0.99278,0.82998,0.67569,0.31074,0.94109,0.000800577,0.000800577,0.000800577 +107,2259.09,0.75705,0.3971,1.01028,0.98701,0.99601,0.994,0.82844,0.67544,0.31136,0.93949,0.000792325,0.000792325,0.000792325 +108,2281.5,0.75363,0.39388,1.00895,0.97884,0.99563,0.99332,0.82609,0.67115,0.30295,0.9263,0.000784073,0.000784073,0.000784073 +109,2304.96,0.75149,0.38225,1.0065,0.98772,0.99154,0.99317,0.82968,0.67163,0.30812,0.93621,0.000775822,0.000775822,0.000775822 +110,2325.71,0.76089,0.39197,1.01517,0.98534,0.99514,0.99231,0.83112,0.67126,0.30055,0.93209,0.00076757,0.00076757,0.00076757 +111,2342.6,0.75073,0.38476,1.00185,0.98613,0.99439,0.99299,0.8342,0.67198,0.30139,0.93257,0.000759318,0.000759318,0.000759318 +112,2364.68,0.76395,0.39102,1.01154,0.98724,0.99342,0.99329,0.8348,0.67889,0.2983,0.94034,0.000751067,0.000751067,0.000751067 +113,2386.59,0.7532,0.38676,1.0144,0.98701,0.99362,0.99316,0.83162,0.66894,0.30464,0.94309,0.000742815,0.000742815,0.000742815 +114,2405.02,0.75618,0.39461,1.01746,0.98217,0.99535,0.99322,0.84076,0.6652,0.31085,0.94707,0.000734564,0.000734564,0.000734564 +115,2426.77,0.74777,0.38232,1.00991,0.99218,0.98958,0.99328,0.83793,0.66754,0.30156,0.93336,0.000726312,0.000726312,0.000726312 +116,2445.38,0.76852,0.39978,1.02014,0.9885,0.99509,0.99322,0.83668,0.65472,0.29741,0.93101,0.00071806,0.00071806,0.00071806 +117,2468.08,0.75201,0.38654,1.01264,0.9845,0.99342,0.99251,0.83991,0.65849,0.29732,0.93658,0.000709809,0.000709809,0.000709809 +118,2492.93,0.74202,0.38277,1.0118,0.9856,0.99505,0.99327,0.83883,0.65726,0.30113,0.93736,0.000701557,0.000701557,0.000701557 +119,2510.85,0.74718,0.3739,1.01558,0.98931,0.99337,0.99312,0.841,0.64707,0.29331,0.93309,0.000693305,0.000693305,0.000693305 +120,2527.98,0.74734,0.38433,1.0057,0.9847,0.99553,0.99316,0.8361,0.66219,0.2962,0.92732,0.000685054,0.000685054,0.000685054 +121,2546.09,0.74988,0.38021,1.00953,0.9809,0.98886,0.99302,0.84236,0.65626,0.2984,0.92012,0.000676802,0.000676802,0.000676802 +122,2567.83,0.74822,0.37356,1.0065,0.98715,0.99457,0.99313,0.84532,0.6538,0.2898,0.91898,0.00066855,0.00066855,0.00066855 +123,2589.94,0.7444,0.3781,1.00803,0.98673,0.99505,0.9932,0.84324,0.64994,0.29424,0.92639,0.000660299,0.000660299,0.000660299 +124,2611.71,0.73273,0.36888,1.00158,0.97793,0.99266,0.99304,0.84473,0.65567,0.29126,0.91993,0.000652047,0.000652047,0.000652047 +125,2633.7,0.74434,0.37509,1.00028,0.98891,0.99497,0.99303,0.84353,0.64307,0.284,0.91544,0.000643795,0.000643795,0.000643795 +126,2656.82,0.73655,0.3747,1.00543,0.98219,0.99254,0.99241,0.84545,0.64377,0.29133,0.91526,0.000635544,0.000635544,0.000635544 +127,2679.27,0.73598,0.38918,1.00341,0.98702,0.99577,0.99278,0.84547,0.64643,0.29329,0.92601,0.000627292,0.000627292,0.000627292 +128,2701.48,0.73401,0.37512,1.00493,0.98259,0.99314,0.99316,0.84421,0.64768,0.29225,0.9263,0.00061904,0.00061904,0.00061904 +129,2723.71,0.73193,0.36211,1.00374,0.98699,0.99478,0.99299,0.84435,0.64256,0.29218,0.92732,0.000610789,0.000610789,0.000610789 +130,2745.99,0.73193,0.37247,0.99894,0.98687,0.9957,0.9933,0.84707,0.64334,0.28502,0.92536,0.000602537,0.000602537,0.000602537 +131,2767.55,0.74823,0.37195,1.01049,0.98519,0.99553,0.99319,0.84685,0.64284,0.29498,0.92719,0.000594286,0.000594286,0.000594286 +132,2786.99,0.73314,0.37568,1.00592,0.98738,0.99553,0.99335,0.84236,0.64481,0.28652,0.92307,0.000586034,0.000586034,0.000586034 +133,2809.07,0.72518,0.36548,0.99442,0.98363,0.99601,0.99145,0.85029,0.63889,0.291,0.91296,0.000577782,0.000577782,0.000577782 +134,2831.44,0.74052,0.37292,0.99842,0.98367,0.9957,0.99269,0.8409,0.64209,0.28644,0.91425,0.000569531,0.000569531,0.000569531 +135,2853.27,0.73246,0.36213,0.99907,0.98344,0.99601,0.99268,0.84764,0.63687,0.27888,0.91253,0.000561279,0.000561279,0.000561279 +136,2875.27,0.72682,0.36198,0.99808,0.98313,0.99601,0.99268,0.84277,0.63649,0.27962,0.91376,0.000553027,0.000553027,0.000553027 +137,2893.72,0.72005,0.36294,1.00469,0.98487,0.99601,0.99309,0.84138,0.63063,0.27776,0.90949,0.000544776,0.000544776,0.000544776 +138,2911.69,0.71229,0.35718,0.98843,0.98599,0.99601,0.99158,0.8507,0.62898,0.27476,0.90804,0.000536524,0.000536524,0.000536524 +139,2927.89,0.73095,0.36788,0.99127,0.98335,0.99601,0.99201,0.84808,0.63137,0.27552,0.90716,0.000528272,0.000528272,0.000528272 +140,2943.16,0.71676,0.3616,0.9885,0.98577,0.99601,0.99313,0.84836,0.62774,0.27489,0.90795,0.000520021,0.000520021,0.000520021 +141,2958.55,0.71154,0.35656,0.9873,0.98742,0.98788,0.99276,0.85253,0.62462,0.27922,0.90872,0.000511769,0.000511769,0.000511769 +142,2978.17,0.70573,0.36748,0.98739,0.98473,0.9879,0.99298,0.84831,0.62274,0.27397,0.90952,0.000503517,0.000503517,0.000503517 +143,3000.2,0.71195,0.35962,0.99922,0.98283,0.99505,0.99289,0.84571,0.62591,0.28162,0.9193,0.000495266,0.000495266,0.000495266 +144,3020.56,0.71951,0.35798,0.99942,0.98715,0.99601,0.99305,0.85442,0.61933,0.26911,0.91392,0.000487014,0.000487014,0.000487014 +145,3038.96,0.72505,0.36001,0.99391,0.98666,0.9957,0.99313,0.85186,0.6209,0.27136,0.90843,0.000478762,0.000478762,0.000478762 +146,3063.5,0.69846,0.36181,0.98314,0.98696,0.99649,0.99338,0.8441,0.62518,0.27363,0.91075,0.000470511,0.000470511,0.000470511 +147,3086.11,0.71238,0.35454,0.98467,0.9877,0.99649,0.99326,0.85507,0.61968,0.2694,0.90448,0.000462259,0.000462259,0.000462259 +148,3109.42,0.71144,0.35305,0.98555,0.98734,0.99601,0.99308,0.85366,0.62087,0.26819,0.90333,0.000454007,0.000454007,0.000454007 +149,3131.62,0.70672,0.35153,0.98435,0.98707,0.98883,0.99297,0.85095,0.61563,0.27302,0.90422,0.000445756,0.000445756,0.000445756 +150,3153.65,0.7031,0.35195,0.98414,0.9866,0.98883,0.99314,0.85403,0.61493,0.27039,0.90564,0.000437504,0.000437504,0.000437504 +151,3175.43,0.71007,0.34456,0.9845,0.98664,0.99649,0.99234,0.85984,0.6145,0.27198,0.90928,0.000429253,0.000429253,0.000429253 +152,3197.51,0.69646,0.34269,0.98575,0.98811,0.99492,0.99242,0.85677,0.61597,0.26737,0.90984,0.000421001,0.000421001,0.000421001 +153,3220.34,0.68626,0.34068,0.98024,0.98643,0.99602,0.99236,0.85639,0.6196,0.26931,0.90891,0.000412749,0.000412749,0.000412749 +154,3240.59,0.698,0.35084,0.98304,0.98705,0.99649,0.99165,0.85268,0.61245,0.26764,0.90972,0.000404498,0.000404498,0.000404498 +155,3260.32,0.70373,0.34826,0.9834,0.9902,0.9941,0.99306,0.85214,0.61287,0.26341,0.90777,0.000396246,0.000396246,0.000396246 +156,3283.17,0.70072,0.35663,0.99202,0.98878,0.99553,0.99276,0.85475,0.61055,0.26666,0.91119,0.000387994,0.000387994,0.000387994 +157,3305.62,0.69375,0.34831,0.98389,0.98797,0.99605,0.9921,0.85334,0.6116,0.26592,0.91188,0.000379743,0.000379743,0.000379743 +158,3327.56,0.70572,0.34746,0.99135,0.98638,0.9905,0.99264,0.85526,0.60794,0.26432,0.90779,0.000371491,0.000371491,0.000371491 +159,3349.85,0.69513,0.34305,0.9832,0.98824,0.99601,0.99304,0.85445,0.61315,0.26366,0.90332,0.000363239,0.000363239,0.000363239 +160,3371.81,0.688,0.33908,0.97723,0.98841,0.99601,0.99304,0.85608,0.60882,0.26528,0.90391,0.000354988,0.000354988,0.000354988 +161,3393.38,0.69905,0.33934,0.98537,0.98962,0.99601,0.99311,0.85783,0.60047,0.25954,0.89944,0.000346736,0.000346736,0.000346736 +162,3414.36,0.68515,0.33975,0.97654,0.98661,0.99649,0.99287,0.86233,0.60082,0.26005,0.90201,0.000338484,0.000338484,0.000338484 +163,3434.21,0.68627,0.34231,0.98456,0.98628,0.99649,0.99311,0.85888,0.60255,0.26354,0.90359,0.000330233,0.000330233,0.000330233 +164,3455.64,0.69148,0.34405,0.98735,0.98803,0.99649,0.99348,0.85465,0.60175,0.26044,0.90324,0.000321981,0.000321981,0.000321981 +165,3473.7,0.69637,0.34316,0.98238,0.9892,0.99601,0.99321,0.85433,0.60169,0.25707,0.90003,0.000313729,0.000313729,0.000313729 +166,3494.9,0.67745,0.33681,0.97708,0.98644,0.99649,0.99314,0.86362,0.59862,0.25627,0.89682,0.000305478,0.000305478,0.000305478 +167,3517.11,0.67455,0.33202,0.97068,0.98796,0.99649,0.99341,0.86775,0.59985,0.25701,0.89638,0.000297226,0.000297226,0.000297226 +168,3541.81,0.691,0.33581,0.98077,0.98963,0.99649,0.99373,0.86582,0.59871,0.25503,0.89376,0.000288974,0.000288974,0.000288974 +169,3564.49,0.67005,0.32247,0.96898,0.99049,0.99601,0.99364,0.86497,0.5947,0.25666,0.89422,0.000280723,0.000280723,0.000280723 +170,3586.69,0.68356,0.32913,0.97078,0.99043,0.9883,0.99365,0.86408,0.59352,0.2585,0.89508,0.000272471,0.000272471,0.000272471 +171,3608.74,0.68008,0.33501,0.97926,0.98871,0.99649,0.99396,0.86606,0.59397,0.25555,0.89624,0.00026422,0.00026422,0.00026422 +172,3630.62,0.68844,0.32801,0.97626,0.98891,0.99649,0.99401,0.86659,0.59213,0.25422,0.89415,0.000255968,0.000255968,0.000255968 +173,3652.22,0.67155,0.32544,0.96543,0.99105,0.99558,0.99384,0.86546,0.59025,0.25348,0.89551,0.000247716,0.000247716,0.000247716 +174,3675.71,0.67721,0.33251,0.97534,0.99135,0.98828,0.99409,0.86755,0.58835,0.25132,0.89448,0.000239465,0.000239465,0.000239465 +175,3693.76,0.67015,0.32316,0.97657,0.98997,0.99553,0.99409,0.86833,0.58711,0.25181,0.89856,0.000231213,0.000231213,0.000231213 +176,3717.77,0.67023,0.3243,0.97342,0.99043,0.99621,0.99392,0.86834,0.58521,0.25129,0.89659,0.000222961,0.000222961,0.000222961 +177,3740.04,0.66617,0.32562,0.97219,0.99011,0.99601,0.99392,0.86697,0.5853,0.25058,0.8947,0.00021471,0.00021471,0.00021471 +178,3763.83,0.67538,0.33418,0.97751,0.99016,0.99601,0.9939,0.8682,0.58666,0.24826,0.8919,0.000206458,0.000206458,0.000206458 +179,3788.33,0.68535,0.34232,0.9824,0.98959,0.99601,0.99432,0.8702,0.5879,0.24999,0.89073,0.000198206,0.000198206,0.000198206 +180,3811.3,0.6588,0.3293,0.97239,0.98984,0.98955,0.99426,0.87021,0.58321,0.24856,0.8911,0.000189955,0.000189955,0.000189955 +181,3829.62,0.66455,0.32668,0.96942,0.99115,0.99601,0.99443,0.86427,0.58156,0.24649,0.89172,0.000181703,0.000181703,0.000181703 +182,3852.7,0.6599,0.3153,0.96577,0.991,0.99649,0.99422,0.86961,0.58204,0.24631,0.89116,0.000173451,0.000173451,0.000173451 +183,3875.04,0.67855,0.33109,0.97815,0.99161,0.99649,0.994,0.8735,0.58253,0.24436,0.888,0.0001652,0.0001652,0.0001652 +184,3896.86,0.67137,0.31882,0.97012,0.99039,0.99649,0.9941,0.87005,0.58179,0.24566,0.89133,0.000156948,0.000156948,0.000156948 +185,3918.29,0.66503,0.32549,0.97032,0.99056,0.99643,0.99408,0.8699,0.58071,0.24422,0.89395,0.000148696,0.000148696,0.000148696 +186,3940.19,0.65434,0.32035,0.96719,0.99047,0.99601,0.99412,0.87351,0.57909,0.24452,0.89179,0.000140445,0.000140445,0.000140445 +187,3961.98,0.65757,0.31861,0.96508,0.99058,0.99601,0.99423,0.87536,0.57626,0.24426,0.89072,0.000132193,0.000132193,0.000132193 +188,3983.74,0.66319,0.31415,0.96827,0.98954,0.99601,0.99414,0.87571,0.5774,0.24414,0.89159,0.000123941,0.000123941,0.000123941 +189,4005.91,0.65476,0.31521,0.96477,0.99084,0.99601,0.99413,0.87519,0.57623,0.24353,0.89091,0.00011569,0.00011569,0.00011569 +190,4027.4,0.66557,0.32221,0.9723,0.9914,0.99553,0.99427,0.87293,0.57585,0.24403,0.89094,0.000107438,0.000107438,0.000107438 +191,4049.72,0.6419,0.28132,0.94288,0.99057,0.99649,0.9944,0.86681,0.58408,0.24864,0.89404,9.91865e-05,9.91865e-05,9.91865e-05 +192,4069.17,0.63787,0.27319,0.94782,0.99087,0.99601,0.99427,0.86692,0.58658,0.25065,0.89786,9.09349e-05,9.09349e-05,9.09349e-05 +193,4090.95,0.63198,0.26987,0.93897,0.99074,0.99601,0.99434,0.86576,0.58719,0.25031,0.89736,8.26832e-05,8.26832e-05,8.26832e-05 +194,4114.56,0.62772,0.26713,0.94362,0.9887,0.99601,0.99437,0.86845,0.58488,0.24764,0.89429,7.44316e-05,7.44316e-05,7.44316e-05 +195,4138.03,0.62223,0.26268,0.94236,0.9906,0.99649,0.99425,0.86705,0.58288,0.24475,0.89274,6.61799e-05,6.61799e-05,6.61799e-05 +196,4159.88,0.61565,0.26089,0.93411,0.99048,0.99649,0.99423,0.86863,0.57973,0.24322,0.89148,5.79283e-05,5.79283e-05,5.79283e-05 +197,4182.16,0.62247,0.26659,0.94223,0.99122,0.99649,0.99432,0.87069,0.57845,0.24302,0.89103,4.96766e-05,4.96766e-05,4.96766e-05 +198,4202.86,0.61837,0.26144,0.93331,0.99151,0.99649,0.99419,0.87,0.57722,0.24151,0.89173,4.1425e-05,4.1425e-05,4.1425e-05 +199,4226.01,0.61664,0.25903,0.93541,0.99173,0.99634,0.99414,0.87173,0.57667,0.24143,0.89174,3.31733e-05,3.31733e-05,3.31733e-05 +200,4247.06,0.6096,0.25772,0.9339,0.99145,0.99601,0.99422,0.87192,0.57562,0.24141,0.89105,2.49217e-05,2.49217e-05,2.49217e-05 diff --git a/机器狗后台服务/.env.dev b/机器狗后台服务/.env.dev index 00e113b..5a6eba2 100644 --- a/机器狗后台服务/.env.dev +++ b/机器狗后台服务/.env.dev @@ -15,4 +15,9 @@ DB_POOL_RECYCLE= 1800 #---------------------------ocr配置---------------------------------------- TEXT_DETECTION_MODEL_DIR= '/home/admin-root/haotian/康达瑞贝斯机器狗/PaddleOCR-3.1.0/output/PP-OCRv5_server_det_infer_20250814' TEXT_RECONGNITION_MODEL_DIR= '/home/admin-root/haotian/康达瑞贝斯机器狗/PaddleOCR-3.1.0/output/PP-OCRv5_server_rec_infer_20250815' -#---------------------------ocr配置end---------------------------------------- \ No newline at end of file +#---------------------------ocr配置end---------------------------------------- + + +#-----------------------------yolov8配置---------------------------------------- +YOLOV8_MODEL_DIR= '/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819/train2/weights/best.pt' +#-----------------------------yolov8配置end---------------------------------------- \ No newline at end of file diff --git a/机器狗后台服务/app/config/config.py b/机器狗后台服务/app/config/config.py index f8e416a..1822638 100644 --- a/机器狗后台服务/app/config/config.py +++ b/机器狗后台服务/app/config/config.py @@ -24,6 +24,10 @@ class OCRSettings(BaseException): TEXT_DETECTION_MODEL_DIR: str = '/home/admin-root/haotian/康达瑞贝斯机器狗/PaddleOCR-3.1.0/output/PP-OCRv5_server_det_infer_20250814' TEXT_RECONGNITION_MODEL_DIR: str = '/home/admin-root/haotian/康达瑞贝斯机器狗/PaddleOCR-3.1.0/output/PP-OCRv5_server_rec_infer_20250815' +class YoloV8Settings(BaseException): + YOLOV8_MODEL_DIR: str = '/home/admin-root/haotian/康达瑞贝斯机器狗/YoloV8Obj/dataset_20250819/train2/weights/best.pt' + + class GetSettings: def __init__(self): @@ -35,6 +39,8 @@ class GetSettings: def get_ocr_settings(self): return OCRSettings() + def get_yolov8_settings(self): + return YoloV8Settings() def parse_cli_args(self): @@ -71,4 +77,6 @@ database_settings = get_settings.get_database_settings() ocr_settings = get_settings.get_ocr_settings() +yolov8_settings = get_settings.get_yolov8_settings() + diff --git a/机器狗后台服务/app/util/yolov8Obj.py b/机器狗后台服务/app/util/yolov8Obj.py new file mode 100644 index 0000000..9a711d7 --- /dev/null +++ b/机器狗后台服务/app/util/yolov8Obj.py @@ -0,0 +1,18 @@ +from ultralytics import YOLO +from app.config.config import yolov8_settings + + +class Yolov8Obj: + + def __init__(self): + self.model = YOLO(yolov8_settings.YOLOV8_MODEL_DIR) + + def detect(self, image_path): + result = self.model.predict(image_path) + boxes = result[0].boxes + + cls = boxes.cls.tolist() + conf = boxes.conf.tolist() + coords = boxes.xyxy.tolist() + + return cls, conf, coords \ No newline at end of file