芜湖大赛-算法赛道-基于视觉的反无人机检测与预警(出题方:大连理工大学)
【初赛A榜】
提交格式:提交测试集的结果CSV文件;(不需要表头)
imgname(图片名:xxx.jpg), label(标签数字:0), x1(左上坐标), y1(左上坐标), x2(右上坐标), y2(右上坐标), x3(右下坐标), y3(右下坐标), x4(左下坐标), y4(左下坐标), score(分数:0.99)
上传的图片名称统一用jpg后缀,坐标使用像素坐标(不用归一化)
压缩包文件命名:参赛选手ID+提交日期;
提交内容:下载初赛A榜图片,进行线下算法开发,提交CSV文件;
提交次数:每天3次
Image2csv.py
自行修改model_path,test_dir,output_csv的地址。
import os
import csv
import torch
from PIL import Image
from pathlib import Path
from ultralytics import YOLO
from tqdm import tqdm
def main():
# 配置路径
model_path = '/mnt/Virgil/YOLO/yolo11-SOD/runs/C3k2-DBB/C3k2-DBB2/weights/best.pt'
test_dir = '/mnt/Virgil/YOLO/drone_dataset/testA'
output_csv = 'DBB_result.csv'
# 确保测试目录存在
if not os.path.exists(test_dir):
print(f"错误:测试集目录不存在: {
test_dir}")
return
# 加载模型
device = 'cuda' if torch.cuda.is_available() else 'cpu'
# device = 'cpu'
print(f"使用设备: {
device}")
try:
model = YOLO(model_path)
print(f"已加载模型: {
model_path}")
except Exception as e:
print(f"加载模型失败: {
e}")
return
# 获取测试集中所有图片并排序
image_extensions = ['.jpg', '.jpeg', '.png', '.bmp', '.webp']
image_files = [f for f in os.listdir(test_dir) if Path(f).suffix.lower() in image_extensions]
# 按图片名排序(忽略扩展名)
image_files.sort(key=lambda x: Path(x).stem)
if</

最低0.47元/天 解锁文章
2万+

被折叠的 条评论
为什么被折叠?



