我需要对caffe2 squeezenet模型进行验证的预处理功能。 我从https://github.com/caffe2/models/tree/master/squeezenet
获得了caffe2模型我尝试了这个,但没有达到预期的准确性 从https://caffe2.ai/docs/tutorial-loading-pre-trained-models.html
获得了这些功能img = skimage.img_as_float(skimage.io.imread(curr_img)).astype(np.float32)
img = rescale(img, 227, 227)
img = crop_center(img, 227, 227)
img = img.swapaxes(1, 2).swapaxes(0, 1)
img = img[(2, 1, 0), :, :]
img = img * 255 - mean
def preprocessing(imgfile):
# read the image
# some resizing
# some cropping
# some mean and std
# preprocess image with mean and std
# some RGB ---> BGR
return img
imagenet验证数据集的预期准确性为57.5%