安装使用insightFace_Pytorch时使用数据集emore dataset,
python prepare_data.py下载解压后发现是蓝色的照片,蓝色的训练也没啥影响,就是看起来有点抑郁,在data_pipe.py下load_mx_rec方法新增一行:
def load_mx_rec(rec_path):
save_path = rec_path/'imgs'
if not save_path.exists():
save_path.mkdir()
imgrec = mx.recordio.MXIndexedRecordIO(str(rec_path/'train.idx'), str(rec_path/'train.rec'), 'r')
img_info = imgrec.read_idx(0)
header,_ = mx.recordio.unpack(img_info)
max_idx = int(header.label[0])
for idx in tqdm(range(1,max_idx)):
img_info = imgrec.read_idx(idx)
header, img = mx.recordio.unpack_img(img_info)
label = int(header.label)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)##新增一行
img = Image.fromarray(img)
label_path = save_path/str(label)
if not label_path.exists():
label_path.mkdir()
img.save(label_path/'{}.jpg'.format(idx), quality=95)
然后数据集解压后就会变正常了。