OpenCV not implementing GOTURN file - python

I am getting this message when I try to create a tracker:
AttributeError: module 'cv2.cv2' has no attribute 'TrackerGOTURN_create'
I've downloaded goturn.caffemodel and goturn.prototxt, and they are in the same folder as my python file.
import cv2
import numpy as np
import os
#import time
ballTracker = cv2.TrackerGOTURN_create()

Related

How to fix this AttributeError: module 'tensorflow' has no attribute 'get_default_graph'?

My tensorflow version=2.0.0,keras version=2.1.5,python version=3.7
code:
import os
import cv2
import numpy as np
import argparse
import json
from PIL import Image
from mtcnn import MTCNN
detector = MTCNN()
return a error as like:
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'
A lot of the newer versions of Tensorflow have inconsistencies.
Try either downgrading your tensorflow version pip install tensorflow==1.13.1
or upgrading your Keras to something 2.3 or above pip install -U keras
If you're brave you could also go digging to find which python file has a line like import keras.something.something and change it to import tensorflow.keras.something

Cannot set up tensorflow gpu object detection

I tried to follow a tutorial on how to setup tensorflow gpu (https://www.youtube.com/watch?v=tPq6NIboLSc) but on the jupyter step i am getting this error :https://pastebin.com/gm3g8cC5
(ive set in in a pastebin because its very long)
I dont know what to do, ive also tried others tutorial but none of the others works, they also got errors ( but they are differents) at the jupyter step.
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
from object_detection.utils import ops as utils_ops
if StrictVersion(tf.__version__) < StrictVersion('1.12.0'):
raise ImportError('Please upgrade your TensorFlow installation to v1.12.*.')
Here is the part where the errors pops.
I dont know what is my tensorflow version since when i am trying to import it i am getting OSError: [WinError 193] %1 is not a valid Win32 application

Import error - ModuleNotFoundError: No module named 'model'

I am trying to replicate the example mentioned at this address by tensorlayer:
https://github.com/tensorlayer/srgan/blob/master/train.py
It has below import statements:
import time, random
import numpy as np
import scipy, multiprocessing
import tensorflow as tf
import tensorlayer as tl
from model import get_G, get_D
from config import config
But this statement is throwing error: from model import get_G, get_D
ModuleNotFoundError: No module named 'model'
I am unable to find such package on 'pypi.org'
The model you imported is a custom module, it is placed in this repo srgan, you got to clone the dependency of train.py too.

No module named 'lib.mouse' - python

I installed the library Mouse in a virtual environment through the conda prompt, and while importing the lib.mouse library, results in an error.
import argparse
import datetime
import imutils
import time
import cv2
import numpy as np
from lib.mouse import Mouse
from lib.video_source import getVideoSource
from lib.polygon import drawQuadrilateral
from lib.user_interaction import getPerpectiveCoordinates
from lib.fgbg_calculations import getThresholdedFrame
from lib.heatmap import Heatmap
from lib.coordinate_transform import windowToFieldCoordinates
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-d5f001ef6688> in <module>
5 import cv2
6 import numpy as np
----> 7 from lib.mouse import Mouse
8 from lib.video_source import getVideoSource
9 from lib.polygon import drawQuadrilateral
ModuleNotFoundError: No module named 'lib.mouse'
I am assuming you copy your code from https://github.com/dev-labs-bg/football-stats
In the repo, there is a folder called lib. You need to copy that too. It's not part of opencv library, it's a python module from that repo.

How to get matplotlib working in Python3 on OS X?

I am trying to do Google's deep learning course on Udemy. For assignment one I need to verify that the following modules are working on my machine, but can't get matplotlib.pyplot working. The python code I must get to compile is the following:
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle
# Config the matplotlib backend as plotting inline in IPython
%matplotlib inline
When I compile and run this like so:
python3.6 nn_assignment_1.py
I get the following error:
Traceback (most recent call last):
File "nn_assignment_1.py", line 9, in <module>
from IPython import display, Image
ImportError: cannot import name 'Image'
Any ideas how to get matplotlib working for python 3 here? I have been banging my head against the keyboard for hours trying to figure this out.

Categories

Resources