how should i go on this type of error
NB AM USING A CPU
transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor()
])
transform_normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
img = Image.open('image.jpeg')
transformed_img = transform(img)
input = transform_normalize(transformed_img)
input = input.unsqueeze(0)
I think if you use only one value in mean, one value in std, then it will start working, i.e.,
transform_normalize = transforms.Normalize(
mean=[0.485],
std=[0.229]
)
after i use this an error is raised
transform_normalize = transforms.Normalize(
mean=[0.485],
std=[0.229]
)
maybe change number of in_channels to 1 in nn.Conv2d, i.e.,
nn.Conv2d(1, out_channels, kernel_size)
how do i do that.please show
this has solved my problem i just grayed the image
import cv2
import numpy as np
img = cv2.imread('jim.jpeg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img2 = np.zeros_like(img)
img2[:,:,0] = gray
img2[:,:,1] = gray
img2[:,:,2] = gray
cv2.imwrite('jim.jpeg', img2)