JdeRobot / DetectionMetrics

Tool to evaluate deep-learning detection and segmentation models, and to create datasets
https://jderobot.github.io/DetectionMetrics/
GNU General Public License v3.0
72 stars 38 forks source link

Error running the tutorial example #208

Closed rubenlucas93 closed 3 years ago

rubenlucas93 commented 3 years ago

Hi, I already followed all the steps mentioned in the tutorial but I got the following issues:

  1. When running detectionStudio with permissions granted with "sudo chmod -R 666 /opt/datasets" I got this error: permissionsError

  2. Once I solved this error giving permissions to all with "sudo chmod -R 777 /opt/datasets" and after configuring the folders and files as indicated I got the following error when clicking in "Select Input". image

image

I also get this warning when launching the app. It may help: image

Thanks in advance!

sergiopaniego commented 3 years ago

Hi! Thanks for the report and for using our tool!

Could you be us some more details about your deployment? Are you using Detection Studio installed fromm source code or the docker images with everything built-in?

rubenlucas93 commented 3 years ago

I installed it from source code.

It may be irrelevant but when building Detection Studio I had another issue: Detection studio was looking for the opencv2/opencv.hpp file in /usr/include folder, but when executing "sudo apt-get install python-opencv" this file was generated in /usr/include/opencv4/opencv2/opencv.hpp so I had to move it to the expected location to make it work.

sergiopaniego commented 3 years ago

When clicking Select Input, a pop up window should appear asking you to select a file from the path where you are executing the application. I'd suggest you to check for permissions for ./DatasetEvaluationApp and the path that it access. Could you try with sudo?

rubenlucas93 commented 3 years ago

Great. It was solved running DatasetEvaluationApp with sudo.

Now when I click in "Process" with this

image

The window closes and I get the following error:

image

Do you want me to create a different issue for this??

Thanks! Best regards, Rubén.

sergiopaniego commented 3 years ago

It says no module named numpy... Have you installed numpy? I have checked and it's not in the requirements. Could be a issue. Please check installing numpy and if you manage to run it we should add that requirement.

rubenlucas93 commented 3 years ago

Hi, I tried the following: uninstalling and installing numpy uninstalling and installing tensorflow uncomment some #includes in TensorFlowInferencer.h

but none of this worked. When I import this module directly in python3 it works and, in fact, I see the module in numpy lib folder

image

I tried to recompile several times and I get a warning about numpy, but after googling, it should not to be a problem: image

I will try to install DetectionStudio via docker now but I will probably need to work with this as developer, so if you have any suggestion or question to solve this problem I would appreciate it.

Thanks! Regards, Rubén.

rubenlucas93 commented 3 years ago

Hi again! Trying to install it via docker.

I ran the command indicated in the install tutorial: docker run -dit --name detection-studio -v [local_directory]:/root/volume/ -e DISPLAY=host.docker.internal:0 jderobot/detection-studio:latest

It created a container but no gui is displayed. I tried to start the container but it does nothing and, when I type "docker ps" I don´t see any container running.

I show below the executed commands and the result (note that the last one is just for letting you know how I installed the docker):

image

Thanks, Best regards, Rubén.

sergiopaniego commented 3 years ago

Answers for both questions:

  1. The module that runs tensorflow and numpy etc is tensoflow_detect.py. That file creates the detection graph and runs inferences over the images. Could you try running isolated that file inferencing one random image to understand where the problem is coming from?

  2. Could you provide logs from docker? docker logs [container_name]? That docker container is supposed to open a window when run. Could be something related to DISPLAY variable. It opens a qt5 window. Dockerfile source is here if you want to take a look.

rubenlucas93 commented 3 years ago

Hi again,

  1. I had a different problem with my environment and I had to install it all from scratch. After repeating the libraries and different tools installations, I got to reach a different error (This time DetectionStudio does not close):

image

image

  1. This is the log displayed: image

I will take another look tomorrow, but today I did not get to solve it.

Thanks a lot for your support!

sergiopaniego commented 3 years ago
  1. The first error says that it can't open the video file. Could you try with another video file?

  2. The docker error is related with the X display. This error tells you that docker can't display the screen because it can't connect to it. You could try opening a new terminal and do:

socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

and the run the application.

rubenlucas93 commented 3 years ago

Hi again!

  1. I tried with 3 videos and none of them is working. However the first video should work, since I read in another issue for detection studio that one of the maintainers suggested to use exactly that one. After reinstalling opencv with ffmpeg codec enabled I get the numpy error again. I will try to solve this reinstalling the numpy module again and I will let you know.

  2. Still not working

rubenlucas93 commented 3 years ago

Hi again.

  1. I got to see that the TensorflowInferencer.cpp didn´t get the same sys.path as the one I have in my environment. I manually add the path '/home/rlucasz/.local/libs/python2.7/site-packages and now it found numpy. Now the problem is that it still doesn´t find some other components related to tensorflow as "tools". I will try to figure it out and let you know how it goes. I also followed the following steps: https://www.cerebrumedge.com/single-post/2017/12/26/compiling-opencv-with-cuda-and-ffmpeg-on-ubuntu-1604

  2. Still not working

rubenlucas93 commented 3 years ago

Hi!!!:

  1. The problem is that, when running DataEvaluationApp with sudo, the paths and permissions are different and, for whatever reason, there are some libraries not found (e.g tensorflow.python.tools or google) giving exception after exception.

Could you help me to run this without sudo??? The problem was the first reported. Do you know the paths accesed by DataEvaluationApp???

Thanks in advance.

rubenlucas93 commented 3 years ago

Hi!!

  1. FIXED FINALLY!!! For whatever reason those two lines where not working other than as a sudo. I commented them and it is working now. image

Sorry for the insistence.

Thanks!! Best regards and merry christmas! Rubén.

sergiopaniego commented 3 years ago

Could you sum up the problematic and the solution, please? It could be interesting updating the code/installation instructions with the solution if we find it necessary. Do you feel something in the instructions is not clear enough? If so, you can open an issue and PR with the content updated.

rubenlucas93 commented 3 years ago

I just let you know in here so you can update it if you consider it needed.

Finally, to install and make detectionStudio work in my Ubuntu 20.04.1 LTS, the provided manual and the following two actions are enough:

  1. Install some libraries needed by opencv to work with some images and video formats: sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install libxvidcore-dev libx264-dev

  2. After downloading opencv and creating the build directory inside, the cmake must be executed with the following flags: make -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D BUILD_opencv_python2=ON -D WITH_FFMPEG=1 -D WITH_CUDA=ON -D CUDA_GENERATION=Pascal -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

image

And then check that the following options are displayed as "YES":

image

  1. In my case the following patch was applied to be able to choose a video to be evaluated, but I am not sure whether this is a matter of my installed qt version or if it is actually an error. Anyway, just in case you want to consider, I leave here the applied patch in path "DetectionStudio/DetectionStudio/DatasetEvaluationApp/mainwindow.cpp".

mainwindow_patch.txt

Note that I modified the extension so I could leave it here, but it should be mainwindow.patch

jmplaza commented 3 years ago

Hi @rubenlucas93, feel free to create and submit a pull-request with those improvements, regarding this issue. We will review it and eventually merge it into the master branch of the project.

rubenlucas93 commented 3 years ago

I was about to create a branch, push my changes to that branch and then create a pull request from there, but it was not possible due to lack of permissions: image

Could you grant me grant me those so I can do it?

Thanks! Regards.

jmplaza commented 3 years ago

Hi @rubenlucas93 , you don't need write access on the repository to create a pull-request to it. Please learn how to do it, for instance: https://gist.github.com/dlaehnemann/e6c8f46eee80112267af70ae92a3df13 and https://stackoverflow.com/questions/2916845/different-default-remote-tracking-branch-for-git-pull-and-git-push/30488025#30488025

rubenlucas93 commented 3 years ago

Right!!!

Learned and done!

Thanks!

sergiopaniego commented 3 years ago

Merged! Closing the issue.

Thanks for your first contribution! 😄