Hey guys i’m trying to deploy my fruits recognition model on webcam and this is my error that i’m facing with
Traceback (most recent call last):
File “c:/Users/Admin/Documents/AI-PYTHON/TEST/realtime_recognization.py”, line 60, in 
prediction   = model(image_data)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\modules\module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “c:\Users\Admin\Documents\AI-PYTHON\TEST\training_model.py”, line 41, in forward
return self.network(xb)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\modules\module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\modules\container.py”, line 100, in forward
input = module(input)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\modules\module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\modules\linear.py”, line 87, in forward
return F.linear(input, self.weight, self.bias)
File “C:\Users\Admin\anaconda3\envs\py36\lib\site-packages\torch\nn\functional.py”, line 1610, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch, m1: [1 x 45000], m2: [36000 x 1000] at C:/cb/pytorch_1000000000000/work/aten/src\THC/generic/THCTensorMathBlas.cu:283
And this is my code
from torch import mode
from lib import *
from utils import *
from training_model import CnnModel
from PIL import Image
from config import resize, mean, std, save_path
data_transforms = transforms.Compose(
[

    transforms.Resize(resize),

    transforms.ToTensor(),

    transforms.Normalize(mean,std)

]

)
device = get_default_device()
model = to_device(CnnModel(), device)
model = load_model(model, save_path)
model.eval()
def Webcam_720p():
cap.set(3,1280)

cap.set(4,720)

def predict_image(prediction):
prediction = prediction.cuda()

prediction = prediction.detach().numpy()

_, preds  = torch.max(prediction, dim=1)

score = np.amax(prediction)

score = '{:6f}'.format(score)

result = datasett.classes[preds[0].item()]

return result,score

def preprocess(image):
image = Image.fromarray(image) #                          

image = data_transforms(image)

image = image.float()

image = image.cuda()

image = image.unsqueeze(0) 

return image 

cap = cv2.VideoCapture(0)
Webcam_720p()
fps = 0
show_score = 0
show_res = ‘Nothing’
sequence = 0
while True:
ret, frame = cap.read()

    

if fps == 4:

    image        = frame[100:450,150:570]

    image_data   = preprocess(image)

    prediction   = model(image_data)

    result,score = predict_image(prediction)

    fps = 0

    if result >= 0.5:

        show_res  = result

        show_score= score

    else:

        show_res   = "Nothing"

        show_score = score

    

fps += 1

cv2.putText(frame, '%s' %(show_res),(950,250), cv2.FONT_HERSHEY_SIMPLEX, 2, (255,255,255), 3)

cv2.putText(frame, '(score = %.5f)' %(show_score), (950,300), cv2.FONT_HERSHEY_SIMPLEX, 1,(255,255,255),2)

cv2.rectangle(frame,(400,150),(900,550), (0,250,0), 2)

cv2.imshow("ASL SIGN DETECTER", frame)

if cv2.waitKey(1) & 0xFF == ord('q'):

    break

cap.release()
cv2.destroyWindow(“ASL SIGN DETECTER”)