simple-faster-rcnn-pytorch icon indicating copy to clipboard operation
simple-faster-rcnn-pytorch copied to clipboard

ValueError: object __array__ method not producing an array

Open isuufeyera opened this issue 4 years ago • 2 comments

Please I have written the following code for translating sign language translation to text, previously it was working but it brings this value error. "ValueError: object array method not producing an array" I am also junior in machine learning any one help?

from keras.models import load_model from keras.preprocessing import image from keras.preprocessing.image import ImageDataGenerator import numpy as np from unidecode import unidecode import cv2

model = load_model('path/my_model.h5')

img_dim = 50

class_labels = ['a','che', 'gne', 'he', 'hhe', 'hhhe', 'je', 'ke', 'le', 'me', 'qe', 're', 'se','she', 'te',]

cap = cv2.VideoCapture(0) font = cv2.FONT_HERSHEY_SIMPLEX while True:

ret, frame = cap.read()
cv2.rectangle(frame, (100, 100), (500, 500), (255, 255, 255), 2)
roi = frame[100:500, 100:500]
img = cv2.resize(roi, (img_dim,img_dim))
img = image.img_to_array(img)
img = np.expand_dims(img, axis=0)
img = img.astype('float32')/255
pred = np.argmax(model.predict(img))
color = (0,0,255)

cv2.putText(frame, class_labels[pred], (50,50), font, 1.0, color, 2)
cv2.imshow('Real_Time_Sign_Langauge_Translation', frame)

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

cap.release() cv2.destroyAllWindows()

isuufeyera avatar Jun 13 '20 07:06 isuufeyera

hello, my friend, have you ever solve your problem? I also encounter the problem in my project.

hqwdev avatar Jul 25 '20 14:07 hqwdev

Yea I have re-installed my TensorFlow previously I have.

isuufeyera avatar Sep 25 '20 12:09 isuufeyera