bb=PIL.Image.fromarray(np.squeeze(temp))
torchvision.transforms.ColorJitter(brightness=0.4,saturation=0.4,contrast=0.4,hue=0.4)(bb)
the information of temp is as follows:
temp.dtype,temp.shape
(dtype(‘float32’), (65, 65, 1))
ValueError Traceback (most recent call last)
in ()
----> 1 torchvision.transforms.ColorJitter(brightness=0.4,saturation=0.4,contrast=0.4,hue=0.4)(bb)
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py in call(self, img)
754 transform = self.get_params(self.brightness, self.contrast,
755 self.saturation, self.hue)
→ 756 return transform(img)
757
758 def repr(self):
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py in call(self, img)
47 def call(self, img):
48 for t in self.transforms:
—> 49 img = t(img)
50 return img
51
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py in call(self, img)
281
282 def call(self, img):
→ 283 return self.lambd(img)
284
285 def repr(self):
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py in (img)
725 if brightness > 0:
726 brightness_factor = random.uniform(max(0, 1 - brightness), 1 + brightness)
→ 727 transforms.append(Lambda(lambda img: F.adjust_brightness(img, brightness_factor)))
728
729 if contrast > 0:
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/functional.py in adjust_brightness(img, brightness_factor)
448
449 enhancer = ImageEnhance.Brightness(img)
→ 450 img = enhancer.enhance(brightness_factor)
451 return img
452
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/PIL/ImageEnhance.py in enhance(self, factor)
35 :rtype: :py:class:~PIL.Image.Image
36 “”"
—> 37 return Image.blend(self.degenerate, self.image, factor)
38
39
~/anaconda3/envs/pytorch4/lib/python3.6/site-packages/PIL/Image.py in blend(im1, im2, alpha)
2629 im1.load()
2630 im2.load()
→ 2631 return im1._new(core.blend(im1.im, im2.im, alpha))
2632
2633
ValueError: image has wrong mode