mpatacchiola / deepgaze

Computer Vision library for human-computer interaction. It implements Head Pose and Gaze Direction Estimation Using Convolutional Neural Networks, Skin Detection through Backprojection, Motion Detection and Tracking, Saliency Map.
MIT License
1.79k stars 478 forks source link

import cv doesn't work in both version #90

Closed omersalkin closed 4 years ago

omersalkin commented 4 years ago

I tried opencv 2,3,4 versions python 2,3 and deepgaze master and 2.0 versions but none of them works for import cv, I know cv removed from opencv after version 3.

mpatacchiola commented 4 years ago

Hi @omersalkin

You should try to understand if this is a problem of your installation first of all. Save the following script inside a file called test.py on your Desktop:

import sys
print("Python version: " + str(sys.version))
import cv2
print("cv2 version: " + str(cv2.__version__))

Now run the script from the terminal with python test.py and if you can with python3 test.py. Report here what you get on the terminal.

omersalkin commented 4 years ago

Hi @mpatacchiola

Python version: 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)] cv2 version: 3.4.5

mpatacchiola commented 4 years ago

@omersalkin with this configuration you need to (re)install Deepgaze 2.0 from branch 2.0 here.

I suggest you to use a conda environment to manage the installations, so you can easily start from scratch if things get messy.

Once you got everything installed try this script and report here what you get:

import sys
print("Python version: " + str(sys.version))
import cv2
print("cv2 version: " + str(cv2.__version__))
print("Importing Bayes filter (no-opencv):")
from deepgaze.bayes_filter import DiscreteBayesFilter
print("Importing Histogram (yes-opencv):")
from deepgaze.color_classification import HistogramColorClassifier
omersalkin commented 4 years ago

@mpatacchiola I dowload the package from 2.0 and use the command "python setup.py install" in the main folder. I have the other required libraries installed at anaconda env (numpy, tensorflow).

I get running the script:

Python version: 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)] cv2 version: 3.4.5 Importing Bayes filter (no-opencv): Importing Histogram (yes-opencv):

Pycharm still gives an error of " Package requirements "cv", "cv2" are not satisfied.". When I click the install requirements, it fails to install.

mpatacchiola commented 4 years ago

@omersalkin If this is the output you get:

Python version: 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)]
cv2 version: 3.4.5
Importing Bayes filter (no-opencv):
Importing Histogram (yes-opencv):

it means that the library is installed correctly. You should get an error on terminal after the line Importing Histogram (yes-opencv): but you do not get anything, meaning that Deepgaze is correctly installed on your system. To double check you can try to run from the terminal (do not use pycharm) some of the example contained in the examples folder.

If you are able to correctly run the examples from the terminal, it means that the problem is pycharm. I know that can be tricky to set up pycharm for OpenCV. If this is the case it would be better if you try to ask to the pycharm support to debug the issue.

omersalkin commented 4 years ago

@mpatacchiola Examples are perfectly working with or without Pycharm. It seems I have to ignore the errors in Pycharm. I was too sorry for not being able to use this beautiful library. Thank you so much for help.