'Why does python say that there is an attribute error for cvzone.Classifier() [closed]

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?



Solution 1:[1]

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.

Solution 2:[2]

Try this

from cvzone.ClassificationModule import Classifier

Then

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 123 456 789 0
Solution 2 cfvoon