mirror of
https://gitee.com/nanjing-yimao-information/ieemoo-ai-gift.git
synced 2025-08-19 22:00:25 +00:00
update
This commit is contained in:
@ -42,7 +42,8 @@ PIN_MEMORY = str(os.getenv("PIN_MEMORY", True)).lower() == "true" # global pin_
|
||||
|
||||
def img2label_paths(img_paths):
|
||||
"""Define label paths as a function of image paths."""
|
||||
sa, sb = f"{os.sep}images{os.sep}", f"{os.sep}labels{os.sep}" # /images/, /labels/ substrings
|
||||
# sa, sb = f"{os.sep}images{os.sep}", f"{os.sep}labels{os.sep}" # /images/, /labels/ substrings
|
||||
sa, sb = f"{os.sep}images{os.sep}", f"{os.sep}labels_class2{os.sep}" # /images/, /labels/ substrings
|
||||
return [sb.join(x.rsplit(sa, 1)).rsplit(".", 1)[0] + ".txt" for x in img_paths]
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ import cv2
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
||||
from ultralytics.data import build_dataloader, build_yolo_dataset, converter
|
||||
from ultralytics.engine.validator import BaseValidator
|
||||
from ultralytics.utils import LOGGER, ops
|
||||
@ -145,7 +146,15 @@ class DetectionValidator(BaseValidator):
|
||||
# Predictions
|
||||
if self.args.single_cls:
|
||||
pred[:, 5] = 0
|
||||
|
||||
# =======Targets 2 分类======
|
||||
column = pred[:,5]
|
||||
condition2 = (column != 10)
|
||||
pred[:,5][condition2] = 0
|
||||
# ===========================
|
||||
|
||||
predn = self._prepare_pred(pred, pbatch)
|
||||
|
||||
stat["conf"] = predn[:, 4]
|
||||
stat["pred_cls"] = predn[:, 5]
|
||||
|
||||
|
@ -41,10 +41,10 @@ def merge_imgs(path1, path2, save_path):
|
||||
# path1 = 'predict_labels110_0524/'
|
||||
# path2 = 'predict_labels110_0613/'
|
||||
|
||||
path1 = '/home/lc/ieemoo-ai-gift/confusion_gift_cls4_0.45/FN/FN_3'
|
||||
path2 = '/home/lc/ieemoo-ai-gift/confusion_gift_cls4_0.45/allBox/allBox_1'
|
||||
path1 = '/home/lc/ieemoo-ai-gift/confusion_gift_cls2_0.45/FP_bg/FP_bg_1'
|
||||
path2 = '/home/lc/ieemoo-ai-gift/confusion_gift_cls2_0.45/allBox/allBox_1'
|
||||
|
||||
#save_path = '/home/yujia/yj/yolov5-6.1/0518_cls10_v5s_new_delTP0.5/labelFn_5_allBox_merge/'
|
||||
save_path = '/home/lc/ieemoo-ai-gift/confusion_gift_cls4_0.45/FN/FN_3_joint/'
|
||||
save_path = '/home/lc/ieemoo-ai-gift/confusion_gift_cls2_0.45/FP_bg/FP_bg_1_joint/'
|
||||
# os.makedirs(save_path, exist_ok=True)
|
||||
merge_imgs(path1, path2, save_path)
|
||||
|
Reference in New Issue
Block a user