AttributeError: module 'cv2' has no attribute 'dnn' - python

I am trying to detect objects in a picture. I am using my trained weights and configuration file. The code runs completely fine on my laptop but it shows
AttributeError: module 'cv2' has no attribute 'dnn'
when I run it on my Raspberry Pi 4B. I have python 3.7 and Open CV 4.5.1
I am unable to solve this.
what should I do.

Related

Cannot find the right tf_runtime wheel for Raspberry Pi 3B+, Python 3.10.2

Whenever I run the code:
tf.lite.Interpreter(model_path=modelName)
The error is:
AttributeError: module 'tensorflow' has no attribute 'lite'
I followed this guide beforehand.
I tried adding contrib
tf.contrib.lite.Interpreter(model_path=modelName)
Didn't work
Also tried installing tflite_runtime but it says it doesn't support my platform

module 'freud' has no attribute 'voronoi'

I am trying to generate VORONOI plot for my system.
I am very naive to python and I am using Freud analysis library for computing Voronoi.
For checking if the sample code is running on my machine, I tried running the sample code of the website for which following is the link:
https://freud.readthedocs.io/en/v1.1.0/examples/module_intros/Voronoi-Voronoi.html
When I am running the code it generates an error saying:
AttributeError: module 'freud' has no attribute 'voronoi'
I compiled the code both using terminal and jupyter notebook.

how u can fix this problem AttributeError: 'scipy' object (scipy) has no attribute 'misc'?

I updated from ubuntu 12.04 to ubuntu 12.10 and the python module I have written suddenly no longer works with the error message that the module scipy does not have the attribute 'misc'. This worked previously. I am still using python 2.7 after the update. Here is where the code crashes
it's very easy
u have to do this step
1-pip install imageio
2-import imageio
3-replace scipy.misc.imsave(image_name,data)
with this code
imageio.imwrite(image_name, data)
enjoy............

opencv3.1 on windows. object has no attribute 'MinDistancePredictCollector'

I'm using OpenCV3.1 with python27 on Windows 7 for face recognition. I compile the OpenCV 3.1 and the opencv_contrib modules using CMAKE and VS Express 2012 with all teh required stuff. Until I reach to the last part, which is for the collector to calculate the matching picture to the database or more specifically this line:
collector = cv2.face.MinDistancePredictCollector()
and outputting this error:
AttributeError: 'module' object has no attribute 'MinDistancePredictCollector'
Refer to #DanMasek reply on my question. Which is to download the proper module tag 3.1.0 and recompile it. problem solved.

Python interpreter can't find face module although it is in the build directory of Opencv 3.0.0

I was reading this tutorial and when I tried to run the attached face recognizer python code
it gave me the following error :
AttributeError: 'module' object has no attribute 'face'
I am on ubuntu 15.04, I have python 2.7, numpy, matplotlib and PIL installed and updated.
I pulled the latest sources of opencv from http://github.com/itseez/openc..., compiled according to the documentation.I added the latest source of opencv contrib from https://github.com/Itseez/open..., compiled according to the documentation.
To make sure:
I have the python bindings i typed the following in the python shell:
import cv2
cv2.version
it returned the following '3.0.0'
The face module folder already in the modules folder in the build directory
I modified the original code with my recent images database directory and haarcascade xml file and
recognizer = cv2.createLBPHFaceRecognizer()
to be
recognizer = cv2.face.createLBPHFaceRecognizer()
When i tried to run type
import cv2
help(cv2.face)
it returned the following error AttributeError: 'module' object has no attribute 'face'
When I tried to explore this file: build/modules/python2/pyopencv_generated_types.h I found that:
pyopencv_face_BasicFaceRecognizer_Type.tp_base = &pyopencv_face_FaceRecognizer_Type; pyopencv_face_LBPHFaceRecognizer_Type.tp_base = &pyopencv_face_FaceRecognizer_Type;
I googled extensively to find a solution and I tried all the available solutions but still stuck at the same point. AttributeError: 'module' object has no attribute 'face'
The last activity about the similar questions was from 7 month ago so I re-ask this question to figure out if there are new answers about this issue.
What should I do?

Categories

Resources