Robert-JunWang / Pelee

Pelee: A Real-Time Object Detection System on Mobile Devices
Apache License 2.0
885 stars 254 forks source link

Using pelee network in classification #60

Open tuan3w opened 5 years ago

tuan3w commented 5 years ago

Hi @Robert-JunWang , I try to test image classification with pelee net. I create a pytorch version and convert weights from your caffe model to pytorch model. However, I wonder what is correct way to pre-process image. I follow your code in python notebook. Here is my code:

def preprocess(imgfile):
    img = cv2.imread(imgfile)
    img = cv2.resize(img, (224,224))
    img_mean = np.array([103.94, 116.78, 123.68], dtype=np.float32)
    img = img.astype(np.float32, copy=True) - img_mean
    img = img * 0.017
    img = img.astype(np.float32)
    img = img.transpose((2, 0, 1))
    return img

I test some images, but the results are bad. I know, that is code used for image detect problem. Is it the same in image classification problem? Thanks.

Robert-JunWang commented 5 years ago

I will open source the code and weight of my Pytorch version PeleeNet soon. The original code can only run on Pytorch 0.3.1. I need some time to make it works on Pytorch 1.0.

tuan3w commented 5 years ago

It's good to hear that. I'm looking forward to seeing your pytorch pretrained.