yun-liu / RCF

Richer Convolutional Features for Edge Detection
Other
752 stars 259 forks source link

test结果 #122

Open bigAndSmall opened 3 years ago

bigAndSmall commented 3 years ago

@yun-liu 您好,我直接运行test得到的最后的输出,全是灰色的灰度图。是不是我的归一化存在问题? def prepare_image_PIL(im): im = im[:,:,::-1] - np.zeros_like(im) # rgb to bgr im /= 255 mean_img = [0.485,0.456,0.406] std_img = [0.229,0.224,0.225] im -= mean_img im /= std_img im = np.transpose(im, (2, 0, 1)) # (H x W x C) to (C x H x W) return im

yun-liu commented 3 years ago

你可以直接用我的代码测试:https://github.com/yun-liu/RCF/blob/master/examples/rcf/RCF-singlescale.ipynb

Caffe的归一化和PyTorch是不一样的,详见如下:

import numpy as np
from PIL import Image

im = Image.open(img_file_path)
im = np.array(im, dtype=np.float32)
im = im[:,:,::-1]
im -= np.array((104.00698793,116.66876762,122.67891434))
im = im.transpose((2, 0, 1))