筛选数据的工具

 

一、利用 shutil.copy 进行处理

# -*- coding: utf-8 -*-
import os
import glob
import cv2
import json
import shutil

def move_src_accord_filter(filter_path, src_path, dataset_path):
    files = glob.glob(filter_path + '/*.png')
    count = 0
    test_path = "/home/user/lcw/RFBnet_Data/obqFind_wanli/test_dataset"
    for image_path in files:
        image_name = image_path[image_path.rfind("/")+1: ]
        src_image_path = os.path.join(src_path, image_name)
        if not os.path.exists(src_image_path):
            continue

        json_name = image_name[:image_name.rfind(".")] + ".json"
        json_image_path = os.path.join(src_path, json_name)
        print("json_image_path is: ", json_image_path)
        if count < 16:
            shutil.copy(src_image_path, dataset_path)
            shutil.copy(json_image_path, dataset_path)
        else:
            return
            # shutil.copy(src_image_path, test_path)
            # shutil.copy(json_image_path, test_path)
        count = count + 1
        #shutil.move(json_image_path, dataset_path)



if __name__ == "__main__":
    # filter_path = "/media/Data/wangjunjie/active_learning/test_lcw"
    # src_path = "/home/user/lcw/RFBnet_Data/obqFind_wanli/verify_data"
    # dataset_path ="/media/Data/wangjunjie/active_learning/test_lcw_src"
    filter_path = "/media/newData/paperData/opqData/da
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值