0

I am trying to make object recognition in python and I am having this error message come up when I run my code:

AttributeError: module 'cvzone' has no attribute 'Classifier'

This is my code:

import cvzone
import cv2

cap = cv2.VideoCapture(0)
myClassifier = cvzone.Classifier('converted_keras/keras_model.h5','converted_keras/labels.txt')

Can anyone help?

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
AstroGuy
  • 56
  • 6

2 Answers2

1

Try this

from cvzone.ClassificationModule import Classifier

Then

myClassifier = Classifier('converted_keras/keras_model.h5','converted_keras/labels.txt')

cfvoon
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 09 '22 at 03:45
0

in the 1.5.4 version of cvzone there is no such function called classifier so try installing the 1.3.3 version of cvzone. pip install cvzone==1.3.3.

123 456 789 0
  • 10,565
  • 4
  • 43
  • 72
vidhan
  • 24
  • 1