I'm getting an attribute error using tensorflow - python

I'm pretty new to python and this code is for object detection, it works fine on my webcam but has an error when using an external camera
This is what I have:
for classId, confidence,box in zip(classIds.flatten(),confs.flatten(),bbox):
cv2.rectangle(img,box,color=(0,255,0),thickness=2)
cv2.putText(img,classNames[classId-1].upper(),(box[0]+10,box[1]+30),
cv2.FONT_HERSHEY_COMPLEX,1,(0,255,0),2)
Here's the message I got:
Traceback (most recent call last):
File "C:/Users/byeo9/PycharmProjects/FYP-ENV/Testing 2.py", line 31, in <module>
for classId, confidence,box in zip(classIds.flatten(),confs.flatten(),bbox):
AttributeError: 'tuple' object has no attribute 'flatten'

Related

Can not find a specific regular expressions

I am trying to scrap specific information from the site but I am receiving an error. Here is the simplified version of the main problem:
import re
b='href="/bp/vendor?vendorCodes=C901U">C901U</a></span></div></div></div><div heyaa'
c=re.search('href="/bp/vendor?vendorCodes=C901U">C901U</a></span></div></div></div><div',b)
If I try to find what is in c I receive this error:
c.group()
Traceback (most recent call last):
File "<pyshell#87>", line 1, in <module>
c.group()
AttributeError: 'NoneType' object has no attribute 'group'
Thanks in advance.

Trying to create a .py ternsorflow learning in games keep getting this callback

C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\Scripts>python OpenGLTensorGrowth.py
Traceback (most recent call last):
File "C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\Scripts\OpenGLTensorGrowth.py", line 29, in
Dict = Canvas.winfo_pixels(info, 3840_2160),[Self.tk.getint]
File "C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\lib\tkinter_init_.py", line 1163, in winfo_pixels
return self.tk.getint(
AttributeError: 'function' object has no attribute 'tk'

cv2.ml.KNearest_create() gives AttributeError: 'module' object has no attribute 'ml'

I am running a Python program in Raspberry Pi on startup (autostart) that I have placed in .bashrc but on startup, OpenCV code snippet contained file is not loading but normal Python program is running and I was using KNN(K Nearest Neighbour) on this algorithm I am getting the following error.
Traceback (most recent call last):
File "Desktop/carPlate/main.py", line 15, in <module>
import DetectChars
File "/home/pi/Desktop/carPlate/DetectChars.py", line 11, in <module>
kNearest = cv2.ml.KNearest_create()
AttributeError: 'module' object has no attribute 'ml'

OpenCV Attribute error: 'module' object has no attribute 'SVM_RBF'

I just started using OpenCV 3.0 in python. I am trying one of the example "didgits.py" and I am getting the Attribute error:
Traceback (most recent call last):
File "C:\Users\Arpit Jindal\Desktop\opencv\sources\samples\python2\digits.py", line 171, in <module>
model = KNearest(k=4)
File "C:\Users\Arpit Jindal\Desktop\opencv\sources\samples\python2\digits.py", line 77, in __init__
self.model = cv2.KNearest()
AttributeError: 'module' object has no attribute 'KNearest'
Then I commented the code for KNearest and tried for SVM only and again I got the Attribute error:
Traceback (most recent call last):
File "C:\Users\Arpit Jindal\Desktop\opencv\sources\samples\python2\digits.py", line 177, in <module>
model = SVM(C=2.67, gamma=5.383)
File "C:\Users\Arpit Jindal\Desktop\opencv\sources\samples\python2\digits.py", line 89, in __init__
self.params = dict( kernel_type = cv2.SVM_RBF,
AttributeError: 'module' object has no attribute 'SVM_RBF'
I tried to search for these variable in OpenCV but couldn't find anything.
Are the python examples not updated? Where can I find the complete list of python API's and reference manual for OpenCV3.0 python, as the online docs is not complete for Machine Learning because I found many python API mentioned in 2.4.9 but not in 3.0?

TypeError: 'NoneType' object has no attribute '__getitem__15'

hello to every one, I want ro run camshift algorithm but an error is created during running time. The error is:
Traceback (most recent call last):
File "C:\Python27\code\extra algorithms\Camshift in OpenCV.py", line 11, in <module>
roi = frame[r:r+h, c:c+w] TypeError: 'NoneType' object has no attribute '__getitem__10'
`
Probably frame is None. So you can't index it like you're doing in frame[r:r+h, c:c+w]. You should initialize the variable or handle the case when it's None.

Categories