import sys import os import random import numpy as np import shutil sys.path.append("/home/shanwei-luo/userdata/mmdetection") from mmdet.apis import (async_inference_detector, inference_detector, init_detector, show_result_pyplot) config_file_1 = '/home/shanwei-luo/userdata/mmdetection/work_dirs/AD_dsxw_test70/AD_dsxw_test70.py' checkpoint_file_1 = '/home/shanwei-luo/userdata/mmdetection/work_dirs/AD_dsxw_test70/epoch_38.pth' img_path = '/home/shanwei-luo/userdata/datasets/PCBA_dataset_v15_MLOPS/ok/' dis_path = '/home/shanwei-luo/userdata/datasets/PCBA_dataset_v15_MLOPS/v3_finetune/dsxw_train/images/' imgs = os.listdir(img_path) imgs_name = [] for img in imgs: imgs_name.append(img_path+img) np_result = np.load('/home/shanwei-luo/userdata/datasets/PCBA_dataset_v15_MLOPS/result.npy') result_score = np_result.tolist() for k_v in np.arange(0.05, 0.1, 0.005): count = 0 index = 0 k_v = 0.07 for result in result_score: if result>=k_v: shutil.copy(img_path+imgs[index], dis_path+imgs[index]) count +=1 print(count) index += 1 print(k_v, count) break imgs = os.listdir(dis_path) print(len(imgs))