BrainPad / FindYourCandy

Apache License 2.0
77 stars 18 forks source link

Camera Take Issue #10

Closed MFennig closed 7 years ago

MFennig commented 7 years ago

Hey,

So have the webapp running, but when we go to :18000/learn, then click the "Start" button, we get this error:

2017-03-01 17:31:45,972 - gensim.models.doc2vec - DEBUG - Fast version of gensim.models.doc2vec is being used 2017-03-01 17:31:45,976 - summa.preprocessing.cleaner - INFO - 'pattern' package not found; tag filters are not available for English 2017-03-01 17:31:45,984 - candysorter.models.texts - INFO - FakeTextAnalyzer loaded. 2017-03-01 17:31:45,984 - candysorter.models.texts - INFO - Loading labels... 2017-03-01 17:31:45,984 - candysorter.models.texts - INFO - Finished loading labels. 2017-03-01 17:31:45,985 - candysorter.models.images.classify - INFO - Loading inception model... 2017-03-01 17:31:46,570 - candysorter.models.images.classify - INFO - Finished loading inception model. 2017-03-01 17:31:46,572 - candysorter.models.images.classify - INFO - Loading transfer model... 2017-03-01 17:31:46,952 - candysorter.models.images.classify - INFO - Finished loading transfer model.

Thoughts?

Thanks!

MFennig commented 7 years ago

@rindai87 did not know if you had any ideas to this?

rindai87 commented 7 years ago

It seems to be a focus issue. Can you execute setup/camera_tune.py again?

max-hana commented 7 years ago

I'm going to look at this more close after I reach my office.

But in general, you can't to have two processes accessing one camera. and chmod is also needed prior to the execution.

MFennig commented 7 years ago

I have no issue with the focus, was able to run everything properly but still stuck with the same error.

max-hana commented 7 years ago

We are trying to reproduce your problem.

The error says that marker is not detected. Since you reported the focus is ok, we're looking for other posibilities.

Meanwhile, could you access to "http://localhost:18000/_capture" and see if the 4 markers are actually visible in your eyes ?

max-hana commented 7 years ago

Looks like we found what you did (or didn't).

First, you didn't set environment variables needed to execute python2 run.py. This error happens when you forgot to define FLASK_ENV. And there are a several other variables needed to work properly. see the webapp/README.md.

Second, you didn't run webapp from uWSGI as described in webapp/README.md. If you just use uWSGI as recommended, this may not happen because variables are already defined in webapp.ini for uWSGI to start python.

MFennig commented 7 years ago

So I ran through and did a triple check on the webapp/README.md and still running into the same issue. Camera is tuned properly and still running into this road block. Any other things I could try?

MFennig commented 7 years ago

@max-hana i tried loading: http://localhost:18000/_capture and i get this as the error:

The image "http://localhost:18000/_capture" can not be displayed because it has errors.

MFennig commented 7 years ago

@max-hana @rindai87 I did notice if I set export FLASK_ENV='dev' then the python2 run.py works but still fails at the camera.

if I run export FLASK_ENV='prd' the python2 run.py does not execute at all

max-hana commented 7 years ago

@MFennig So, you executed both webapp and robot-arm from command line?

If that is the case, you need to stop all uwsgi and nginx services.

i tried loading: http://localhost:18000/_capture and i get this as the error: The image "http://localhost:18000/_capture" can not be displayed because it has errors.

Please check the following:

if I run export FLASK_ENV='prd' the python2 run.py does not execute at all

Assuming you're executing the following commands.

export FLASK_ENV='prd' 
cd /home/brainpad/FindYourCandy/webapp/
python2 run.py 

Running with prd will eliminate messages on terminal. Therefore you better look at the log file instead of terminal.

# Use another terminal and then type
tail -f /home/brainpad/FindYourCandy/webapp/logs/app.log

As mentioned in setup/troubleshooting.md you have to wait for about 3,4 minutes before you can access on port 18000, otherwise you get error on your browser.

Important! When you demo, please use uwsgi because python2 run.py uses flask's web server which seems to be less stable.

rindai87 commented 7 years ago

As @max-hana said, do you run some processes at the same time?

  1. Stop or Kill all process about camera
  2. Execute python2 run.py for debugging
  3. Execute process from uwsgi for production

Please check also @max-hana 's advise.

MFennig commented 7 years ago

@rindai87 @max-hana

So yes working thru the 'prd' and 'dev', the logs and terminal both show the same issue. Something I would like to point out on the issue above is this line:

OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/brainpad/opencv_from_git/opencv/modules/imgproc/src/color.cpp, line 9748

I was wondering if there is something that is causing that in particular? This could be what is actually screwing up.

max-hana commented 7 years ago

Maybe thats true.... but If you install opencv as instructed, there should be no error.

When installing opencv from source, it is pretty much affected by what libs you installed ahead. We double tested from Ubuntu installation followed by exact command lines as documented from scratch.

Here is our cv2.so file size. brainpad:~$ ls -l /usr/local/lib/python2.7/dist-packages/cv2.so -rw-r--r-- 1 root staff 3710408 Feb 21 16:39 /usr/local/lib/python2.7/dist-packages/cv2.so

cv2.zip

It's Saturday morning in japan and I need to get going ;-) Good luck!

rindai87 commented 7 years ago

@MFennig How about your status?

rindai87 commented 7 years ago

We confirmed your setup didn't follow the correct procedure.