scale_th = np.array([500000,2500000,7000000,15000000])

    for fn in datas[:,0]:
        idx_colorgain = np.where(datas_colorgain[:,0]==fn)[0][0]
        cg = datas_colorgain[idx_colorgain]
        hw = cg[4]*cg[5]
        ss = (scale_th<=hw).sum()
        s_hw.append(ss)
    
    
    if fn_meta is not None:
        df = pd.read_csv(fn_meta)
        datas_meta = df.values
        datas_meta = np.hstack((datas_meta[:,:5], np.int32(s_hw)[:,None]))
        
        dict_im_fq = count_imfq_samemeta(datas_meta,meta_format = 20)
    

        
    flist = [osp.join(fd_in, fn+'.jpg') for fn in datas[:,0]]
    


    for idx, fn in enumerate(tqdm(flist)):
        #img = cv2.imread(fn)
        #hh,ww,_ = img.shape
  
        #gt = np.where(datas[idx][1:]==1)[0][0]
        gt = datas[idx][-1]
        if map_gt is not None:
            if gt>= len(map_gt):
Пример #2
0
#colorgain_csv = './dat/all18_colorgain1.csv'
#out_csv = './dat/all18_info1.csv'

info_list = []
df = pd.read_csv(colorgain_csv)
datas_colorgain = df.values

for fn_gt, fn_meta, map_gt in zip(fn_gts, fn_metas, map_gts):

    df = pd.read_csv(fn_gt)
    datas = df.values

    if fn_meta is not None:
        df = pd.read_csv(fn_meta)
        datas_meta = df.values
        dict_im_fq = count_imfq_samemeta(fn_meta)

    flist = [osp.join(fd_in, fn + '.jpg') for fn in datas[:, 0]]

    for idx, fn in enumerate(tqdm(flist)):
        img = cv2.imread(fn)
        hh, ww, _ = img.shape

        if fn_meta is not None:
            idx_meta = np.where(datas_meta[:, 0] == Path(fn).stem)[0][0]
            meta = datas_meta[idx_meta][[1, 2, 4]]
            n_rep = dict_im_fq[Path(fn).stem]
        else:
            meta = [math.nan, math.nan, math.nan]
            n_rep = 1.0