Closed nyck33 closed 5 years ago
Hi @nyck33
There may be a problem with the link to the libraries in your system, with the module not found. Try the following:
After installing deepgaze through sudo python setup.py install
open a new terminal. Start a new python console through the command python2
(for Deepgaze 1.0) or python3
(for Deepgaze 2.0). Now just try to import the module writing in the python console import deepgaze
. If the module is correctly installed you should not get any error, otherwise please report the error that you get.
I have it running online in Colab now but getting
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-22-ba7b5b584cba> in <module>()
----> 1 cx, cy = my_mask_analyser.returnMaxAreaCenter(image_mask)
2 cnt = my_mask_analyser.returnMaxAreaContour(image_mask)
/content/deepgaze/deepgaze/mask_analysis.py in returnMaxAreaCenter(self, mask)
ValueError: too many values to unpack (expected 2)
I was getting another error before that related to def returnMaxAreaCenter()
for the line contours, hierarchy = cv2.findContours(mask, 1, 2)
so I added a _
in front of contours
to make it _, contours, hierarchy = cv2.findContours(mask, 1, 2)
This may be due to incompatibility between the version of Deepgaze installed and the version of OpenCV. Please check your setup, in particular be sure that you are using OpenCV 2 with Deepgaze 1.0 or OpenCV 3 with Deepgaze 2.0.
Will do. Thanks for replying.
On Wed, 10 Jul 2019 at 16:11, Massimiliano Patacchiola < notifications@github.com> wrote:
Hi @nyck33 https://github.com/nyck33
There may be a problem with the link to the libraries in your system, with the module not found. Try the following:
After installing deepgaze through sudo python setup.py install open a new terminal. Start a new python console through the command python2 (for Deepgaze 1.0) or python3 (for Deepgaze 2.0). Now just try to import the module writing in the python console import deepgaze. If the module is correctly installed you should not get any error, otherwise please report the error that you get.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mpatacchiola/deepgaze/issues/81?email_source=notifications&email_token=AGAFZKIZTUVFP6LPW747T5TP6WKTHA5CNFSM4H7MM532YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZSVS5I#issuecomment-509958517, or mute the thread https://github.com/notifications/unsubscribe-auth/AGAFZKPI5JW3Z322CLLT2RLP6WKTHANCNFSM4H7MM53Q .
-- Nobutaka Github: https://github.com/nyck33 Blog: https://nobu-portfolio.blogspot.com/ Linkedin: https://www.linkedin.com/in/stayfit4ever/ Tel:0900344207 Skype: nobutaka.gold3@gmail.com Line: nobu_2018
@mpatacchiola I git cloned 2.0 version with command git clone https://github.com/mpatacchiola/deepgaze.git -b 2.0 --single-branch
. Then I checked the opencv version on Colab which turned out to be 3.4.3.
So I should be good to go I thought but still getting the Value Error per below:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-16-f45818827aea> in <module>()
1 '''for i in range(len(a)):
2 print(a[i])'''
----> 3 cx, cy = my_mask_analyser.returnMaxAreaCenter(image_mask)
4 cnt = my_mask_analyser.returnMaxAreaContour(image_mask)
/usr/local/lib/python3.6/dist-packages/deepgaze/mask_analysis.py in returnMaxAreaCenter(self, mask)
50 if(len(mask.shape) == 3):
51 mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
---> 52 contours, hierarchy = cv2.findContours(mask, 1, 2)
53 area_array = np.zeros(len(contours)) #contains the area of the contours
54 counter = 0
ValueError: too many values to unpack (expected 2)
Reverting back to opencv 2 on Colab is a bit of work but I'll give it a shot. Regardless, the notebooks should work with either master (1.0) or 2.0?
Deepgaze 2.0 is still work in progress at the moment and it is possible that there may be a few hidden issues to fix. The notebooks should work with the version 2.0. @kamathhrishi is taking care of the porting at the moment, let's see if he can give a look to it...
@nyck33 for the moment you can simply substitute: contours, hierarchy = cv2.findContours(mask, 1, 2)
with _, contours, hierarchy = cv2.findContours(mask, 1, 2)
and then install again the library to make the change effective. This should be due to the fact that in OpenCV 3 the function cv2.findContours()
now returns 3 values instead of 2. @kamathhrishi I think a simple patch consists in checking the version of OpenCV with a conditional operator and call the appropriate method. Something like this:
import cv2
(major, minor, _) = cv2.__version__.split(".")
if(major=='2'):
contours, hierarchy = cv2.findContours(mask, 1, 2)
elif(major=='3'):
_, contours, hierarchy = cv2.findContours(mask, 1, 2)
@nyck33 if you fix it, you can send a pull request on the 2.0 branch and I will add it to the repo.
@mpatacchiola I guess you already kind of solved it:) I was just looking for a way to detect profile faces (side faces) so have to move on at this time but hopefully someone else will find info above useful.
This has now been fixed in branch 2.0
I git clone'd both master and 2.0 branches and tried to install but I keep getting a no module name 'deepgaze' error in the
face_center_color_classification
notebook's first cell.