juandes/pikachu-detection

Problem with python interpreter in Android studio

Closed this issue · 7 comments

nlona commented

I unpacked the app, imported in android studio, set python interpreter with 3.6 but it tells that is missing anyway

Hi, I don't fully understand your issue. Are you trying to run the Python parts from Android Studio?
If so, then I'm afraid I can't help you. During my tutorial, I used Android Studio exclusively for the Android part.

The rest (training and evaluation) was done in a second "environment" on TF Object Detection API

nlona commented

hp@hp-desktop:~/pikachu-detection-master$ python3 detection_video.py /usr/local/lib/python3.6/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version! RequestsDependencyWarning) Traceback (most recent call last): File "detection_video.py", line 21, in <module> from utils import label_map_util ModuleNotFoundError: No module named 'utils' hp@hp-desktop:~/pikachu-detection-master$ python3 detection_video.py /usr/local/lib/python3.6/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version! RequestsDependencyWarning) Traceback (most recent call last): File "detection_video.py", line 20, in <module> from utils import label_map_util ModuleNotFoundError: No module named 'utils' hp@hp-desktop:~/pikachu-detection-master$ python2.7 detection_video.py Traceback (most recent call last): File "detection_video.py", line 12, in <module> import tensorflow as tf ImportError: No module named tensorflow hp@hp-desktop:~/pikachu-detection-master$ python2.7 detection_video.py Traceback (most recent call last): File "detection_video.py", line 12, in <module> import tensorflow as tf ImportError: No module named tensorflow hp@hp-desktop:~/pikachu-detection-master$ python2.7 gebash: python2.7: errore di sintassi: operatore aritmetico non valido (il token dell'errore è ".7") hp@hp-desktop:~/pikachu-detection-master$ python2.7 genebash: python2.7: errore di sintassi: operatore aritmetico non valido (il token dell'errore è ".7") hp@hp-desktop:~/pikachu-detection-master$ python2.7 generate_tfrecord.py Traceback (most recent call last): File "generate_tfrecord.py", line 18, in <module> import pandas as pd ImportError: No module named pandas hp@hp-desktop:~/pikachu-detection-master$

Here you can can se that with 2.7 does not work launching from the console

Hi,
It seems like you are missing all the dependencies. How are you executing the scripts?
In my article I explain how to do it.

nlona commented

tensorflow is corrected installed via pip3 with also gpu support as you can see but if I run in the terminal

utils was missing but now installed but i got this warnings

from PIL import Image label_map_util

from utils import label_map_util

from utils import visualization_utils as vis_util

import cv2

hp@hp-desktop:/pikachu-detection-master$ python3 detection_video.py
Traceback (most recent call last):
File "detection_video.py", line 19, in
from utils import label_map_util
ImportError: cannot import name 'label_map_util'
hp@hp-desktop:
/pikachu-detection-master$ python3.6 detection_video.py
Traceback (most recent call last):
File "detection_video.py", line 19, in
from utils import label_map_util
ImportError: cannot import name 'label_map_util'

Did you try this?: tensorflow/models#1990 (comment)
You need to make some small changes to your PYTHONPATH.

Also, keep in mind that I was using a quite outdated version of TensorFlow, as well as Python 2.7.

However, I was looking at the most recent version, and label_map_util is still there. So it shouldn't be an issue.

nlona commented

`PASS: protobuf-test
PASS: protobuf-lazy-descriptor-test
PASS: protobuf-lite-test
PASS: google/protobuf/compiler/zip_output_unittest.sh
PASS: google/protobuf/io/gzip_stream_unittest.sh
PASS: protobuf-lite-arena-test
PASS: no-warning-test

Testsuite summary for Protocol Buffers 3.7.1

TOTAL: 7

PASS: 7

SKIP: 0

XFAIL: 0

FAIL: 0

XPASS: 0

ERROR: 0

============================================================================
make[3]: uscita dalla directory "/home/hp/protobuf/src"

hp@hp-desktop:$ python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
2019-05-18 13:00:41.719299: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2019-05-18 13:00:41.728466: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.729095: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.392
pciBusID: 0000:01:00.0
2019-05-18 13:00:41.729183: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.729771: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.730322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1752] Adding visible gpu devices: 0
2019-05-18 13:00:41.730697: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: FMA
2019-05-18 13:00:41.884271: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.884977: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5262ef0 executing computations on platform CUDA. Devices:
2019-05-18 13:00:41.885023: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): GeForce GTX 1050 Ti, Compute Capability 6.1
2019-05-18 13:00:41.908242: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3194025000 Hz
2019-05-18 13:00:41.908670: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55e3c20 executing computations on platform Host. Devices:
2019-05-18 13:00:41.908717: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): ,
2019-05-18 13:00:41.908960: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.909549: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.392
pciBusID: 0000:01:00.0
2019-05-18 13:00:41.909650: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.910237: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.910867: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1752] Adding visible gpu devices: 0
2019-05-18 13:00:41.911164: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2019-05-18 13:00:41.912550: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1180] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-18 13:00:41.912584: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1186] 0
2019-05-18 13:00:41.912593: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1199] 0: N
2019-05-18 13:00:41.912861: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.913487: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 13:00:41.914121: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1325] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3204 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
tf.Tensor(-192.12294, shape=(), dtype=float32)
hp@hp-desktop:
$

`

But I cannot get work at all

https://imgur.com/a/FXlx7N7

Hi again, sorry for the delay.
Any updates regarding this?

The only possible thing I see is that your PYTHONPATH is somehow wrong and not finding the imports.
Could you just run all the instructions from the Object Detection API directory and not from Android Studio? Don't run detection_video.py from the directory you cloned, instead of that, clone this, add detection_video.py to models/research/object_detection and then execute python object_detection/detection_video.py.

Hope that helps.