meijieru / crnn.pytorch

Convolutional recurrent network in pytorch
MIT License
2.4k stars 657 forks source link

Something wrong in class resizeNormalize(object) #221

Closed HansRen1024 closed 2 years ago

HansRen1024 commented 4 years ago

I read and process the data with opencv format. Though I changed the code from "img = img.resize(self.size, self.interpolation)" to "img = np.resize(img, self.size)", the image may damage after "img.sub(0.5).div(0.5)". So I recommend you guys write a new resize and normalization function if you process your data with opencv format, such as:

img = np.resize(img, self.size) img = transforms.ToTensor()((np.array(img, 'f') - 127.5) / 127.5)