[CF]提交文件

This commit is contained in:
songbingle 2025-06-09 15:04:04 +08:00
parent f2bd169955
commit 1d2dc0725c
27 changed files with 121 additions and 35 deletions

View File

@ -1 +1 @@
0 0.48771291971206665 0.7472500205039978 0.1420592963695526 0.09844733029603958
66 0.731589674949646 0.2058008313179016 0.35398292541503906 0.4006979465484619

View File

@ -1 +1,4 @@
0 0.4994882047176361 0.4316258728504181 0.06551017612218857 0.2727106511592865
41 0.5203449130058289 0.7177358269691467 0.20717255771160126 0.49684786796569824
41 0.3389294445514679 0.30331751704216003 0.27720382809638977 0.6009600162506104
66 0.886417031288147 0.655850887298584 0.22624778747558594 0.5352596640586853
65 0.2264287918806076 0.932266891002655 0.14752043783664703 0.13386501371860504

View File

@ -1 +1 @@
0 0.40836668014526367 0.8042894005775452 0.12351169437170029 0.23603889346122742
66 0.8215314745903015 0.4208154082298279 0.35489732027053833 0.8266181349754333

View File

@ -1 +1,2 @@
0 0.4408986270427704 0.5993431806564331 0.13503237068653107 0.09413503110408783
65 0.6359551548957825 0.12216883152723312 0.2831403613090515 0.23993046581745148
41 0.17873314023017883 0.7142530679702759 0.15591652691364288 0.40208977460861206

View File

@ -1 +1,4 @@
0 0.5420313477516174 0.30165743827819824 0.07260242849588394 0.21659258008003235
66 0.8745381236076355 0.2518923580646515 0.25000420212745667 0.4953087270259857
41 0.6070730686187744 0.5007842183113098 0.20938816666603088 0.41958943009376526
43 0.41047751903533936 0.88866126537323 0.12559576332569122 0.21784034371376038
41 0.33719685673713684 0.2652938663959503 0.35088589787483215 0.5305877327919006

View File

@ -1 +1 @@
0 0.41204801201820374 0.6444148421287537 0.13645657896995544 0.09047947824001312
65 0.5872904658317566 0.13676130771636963 0.27503660321235657 0.2694833278656006

View File

@ -1 +1 @@
0 0.37702181935310364 0.4168713688850403 0.11676235496997833 0.16663137078285217
66 0.7638658881187439 0.19576500356197357 0.43141382932662964 0.3829491436481476

View File

@ -0,0 +1 @@
66 0.18339355289936066 0.4961889088153839 0.3619512915611267 0.9753192067146301

View File

@ -1 +1,3 @@
0 0.6337539553642273 0.49059435725212097 0.058382414281368256 0.23265939950942993
41 0.6567089557647705 0.7279508709907532 0.1723017394542694 0.41854044795036316
66 0.9267964959144592 0.6869313716888428 0.14521464705467224 0.4587825834751129
41 0.4756928086280823 0.3133438527584076 0.22482411563396454 0.6266877055168152

View File

@ -1 +1 @@
0 0.23642759025096893 0.5935156345367432 0.14542384445667267 0.15417061746120453
66 0.6173995733261108 0.23242317140102386 0.42917877435684204 0.4543992877006531

View File

@ -0,0 +1 @@
66 0.2192573845386505 0.497122585773468 0.37990525364875793 0.9785259366035461

View File

@ -0,0 +1 @@
66 0.7794128656387329 0.38904860615730286 0.43975722789764404 0.7610057592391968

View File

@ -1 +1 @@
0 0.07122450321912766 0.9290686845779419 0.1418805867433548 0.1389940083026886
66 0.3840898871421814 0.3075457811355591 0.39144864678382874 0.5985426902770996

View File

@ -1 +1,5 @@
0 0.47170019149780273 0.46518373489379883 0.07083358615636826 0.2886744439601898
41 0.5073683261871338 0.7413761615753174 0.23081880807876587 0.5018818378448486
66 0.8785611987113953 0.6182729005813599 0.2415771484375 0.6008212566375732
39 0.46806642413139343 0.4267922639846802 0.059397317469120026 0.20679564774036407
75 0.2924177050590515 0.3330554664134979 0.325281023979187 0.663470447063446
41 0.2923850119113922 0.3357616066932678 0.3211429715156555 0.665602445602417

View File

@ -1 +1,5 @@
0 0.558928906917572 0.4562530517578125 0.06115283817052841 0.2527773976325989
41 0.4025701582431793 0.3041629493236542 0.2520607113838196 0.6012737154960632
41 0.5779143571853638 0.7180625200271606 0.1843167245388031 0.4548136293888092
66 0.9020647406578064 0.6791548132896423 0.1951572448015213 0.49554306268692017
65 0.27958887815475464 0.9193099737167358 0.1769428551197052 0.16138000786304474
39 0.6496475338935852 0.30608123540878296 0.17430464923381805 0.6093853712081909

View File

@ -1 +1,5 @@
0 0.6931028366088867 0.46893933415412903 0.055806733667850494 0.2130880504846573
41 0.7239271998405457 0.6868422031402588 0.1673082411289215 0.4081767201423645
65 0.9475198984146118 0.6036545038223267 0.10397186130285263 0.4299028217792511
39 0.5200294256210327 0.31427666544914246 0.23782959580421448 0.6235197186470032
75 0.5196282863616943 0.3139869272708893 0.23740564286708832 0.626532256603241
67 0.4804510772228241 0.9203866124153137 0.13990208506584167 0.15822109580039978

View File

@ -1 +1,4 @@
0 0.46084585785865784 0.3432014584541321 0.09701843559741974 0.198017880320549
66 0.8266304731369019 0.20892952382564545 0.3460872769355774 0.4080584943294525
41 0.547095537185669 0.5047687888145447 0.24446941912174225 0.43043774366378784
73 0.47169989347457886 0.17138226330280304 0.3208259344100952 0.3397272527217865
43 0.41639193892478943 0.9306352138519287 0.08508815616369247 0.13757216930389404

View File

@ -1 +1,6 @@
0 0.6320920586585999 0.33943668007850647 0.07225856930017471 0.22301295399665833
41 0.444489449262619 0.26370611786842346 0.2797574996948242 0.5261057615280151
41 0.6685810089111328 0.5536766052246094 0.182246595621109 0.40671131014823914
43 0.42987874150276184 0.8771693706512451 0.15952062606811523 0.24302096664905548
66 0.9168145656585693 0.39428022503852844 0.1657094955444336 0.47677600383758545
63 0.2034837305545807 0.47341403365135193 0.40639734268188477 0.9309749007225037
65 0.9168401956558228 0.39420291781425476 0.16524048149585724 0.4775548279285431

View File

@ -1 +1,4 @@
0 0.6932379007339478 0.47050267457962036 0.053142547607421875 0.2151389867067337
41 0.7205477356910706 0.7003772258758545 0.16736488044261932 0.40856966376304626
65 0.9491695165634155 0.650397539138794 0.10056362301111221 0.4320901334285736
41 0.5244911909103394 0.31001806259155273 0.22488437592983246 0.6199653744697571
43 0.4532232880592346 0.9155839681625366 0.16217610239982605 0.16883206367492676

View File

@ -1 +1,3 @@
0 0.42775678634643555 0.5280251502990723 0.08043766021728516 0.29130128026008606
66 0.858312726020813 0.5503764748573303 0.2823540270328522 0.6806249022483826
41 0.48514097929000854 0.763572096824646 0.25790688395500183 0.458000510931015
41 0.23023129999637604 0.38117530941963196 0.3835048973560333 0.7605958580970764

BIN
runs/detect/predict58/5.avi Normal file

Binary file not shown.

Binary file not shown.

40
src/aa.py Normal file
View File

@ -0,0 +1,40 @@
from ultralytics import YOLO
import cv2
import numpy as np
from video import video_to_pic
import os
from PIL import Image
label = input("请输入标签:")
# model = YOLO("yolov8n.pt")
model = YOLO(r"C:/workspace/le-yolo/runs/detect/train42/weights/best.pt")
video_path = 'C:/workspace/le-yolo/res/3.mp4'
video_to_pic(video_path)
file_path = 'C:/workspace/le-yolo/data/images/test/'
for filename in os.listdir(file_path):
img = cv2.imread(filename)
results = model(img)
# img_path = '../data/images/train/3fb0f9ac-t2_0.jpg'
# img = cv2.imread(img_path)
# results = model(img)
detections = results[0].boxes
boxes = detections.xyxy.cpu().numpy()
x1_min = int(np.min(boxes[:, 0]))
y1_min = int(np.min(boxes[:, 1]))
x2_max = int(np.max(boxes[:, 2]))
y2_max = int(np.max(boxes[:, 3]))
whole_image_box = np.array([[x1_min, y1_min, x2_max, y2_max]])
# 可视化
original_boxes = results[0].boxes.xyxy.tolist()
new_box = whole_image_box.tolist()
combined_boxes = original_boxes + new_box
combined_boxes = np.array(combined_boxes)
annotated_image = results[0].plot()
cv2.imshow(label, annotated_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

View File

@ -1,6 +1,7 @@
import torch
from ultralytics import YOLO
import os
from video import video_to_pic
class Yolov8Detect():
def __init__(self, weights):
@ -35,8 +36,12 @@ def txt_construct(save_path, label_text):
txt_file.write('\n')
if __name__ == '__main__':
model_path = r'C:\workspace\le-yolo\runs\detect\train40\weights\best.pt'
# model_path = r'C:\workspace\le-yolo\runs\detect\train40\weights\best.pt'
model_path = r'C:\workspace\le-yolo\src\yolov8n.pt'
model = Yolov8Detect(model_path)
video_path = 'C:/workspace/le-yolo/res/6.mp4'
video_to_pic(video_path)
model.inferences(video_path)
import glob
image_path = glob.glob('../data/images/test/*.jpg')
for img_path in image_path[:]:

View File

@ -1,6 +1,7 @@
from ultralytics import YOLO
import cv2
import os
# model = YOLO("yolov8n.pt")
model = YOLO(r"C:\workspace\le-yolo\runs\detect\train40\weights\best.pt")
target_class = 0
cap = cv2.VideoCapture('../res/5.mp4')

View File

@ -5,7 +5,7 @@ model = YOLO("yolov8n.pt")
# model = YOLO(r"C:\workspace\le-yolo\runs\detect\train40\weights\last.pt")
model.train(data="data.yaml", epochs=100, batch=8, device=0, imgsz=640, augment = True)
# model.train(data="data.yaml", epochs=100, batch=8, device='cpu', imgsz=640, augment = True, lr = 0.001,wight_decay = 0.0005 )
model.val()
# model.val()
print('训练完成')
end_time = time.time()
run_time = end_time - start_time

View File

@ -1,17 +1,20 @@
import cv2
videopath = 'C:/workspace/le-yolo/res/6.mp4'
video = cv2.VideoCapture(videopath)
num = 0
if video.isOpened():
ret, frame = video.read()
else:
ret = False
timeF = 10
filepath = 'C:/pic/test_'
while ret:
ret, frame = video.read()
if num % timeF == 0:
cv2.imwrite(filepath + str(num) + '.jpg', frame)
num = num + 1
cv2.waitKey(1)
video.release()
def video_to_pic(vide_opath):
# vide_opath = 'C:/workspace/le-yolo/res/6.mp4'
video = cv2.VideoCapture(vide_opath)
num = 0
if video.isOpened():
ret, frame = video.read()
else:
ret = False
timeF = 10
filepath = 'C:/pic/test_'
while ret:
ret, frame = video.read()
if num % timeF == 0:
cv2.imwrite(filepath + str(num) + '.jpg', frame)
num = num + 1
cv2.waitKey(1)
video.release()
video_to_pic('C:/workspace/le-yolo/res/6.mp4')