目前了解针对ms1m数据集 有效
依赖项:
pil
opencv
mxnet
tqdm
load_images_from_bin.py
直接上代码:
#!/usr/bin/env python
# encoding: utf-8
'''
@desc: For AgeDB-30 and CFP-FP test dataset, we use the mxnet binary file provided by insightface, this is the tool to restore
the aligned images from mxnet binary file.
You should install a mxnet-cpu first, just do 'pip install mxnet==1.2.1' is ok.
'''
from PIL import Image
import cv2
import os
import pickle
import mxnet as mx
from tqdm import tqdm
import argparse
'''
For train dataset, insightface provide a mxnet .rec file, just install a mxnet-cpu for extract images
'''
def load_mx_rec(rec_path, save_path):
save_path = os.path.join(rec_path, save_path)
if not os.path.exists(save_path):
os.makedirs(save_path)
imgrec = mx.rec