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:
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)