idealo / imagededup

😎 Finding duplicate images made easy!
https://idealo.github.io/imagededup/
Apache License 2.0
5.16k stars 456 forks source link

How to run on the GPU? #92

Closed philipperemy closed 4 years ago

philipperemy commented 4 years ago

Using latest imagededup. I uninstall tensorflow and installed tensorflow-gpu==2.0.

Any ideas why? Anything more to do? I've already run successfully apps on tensorflow with GPUs.

Thanks

Output of imagededup.

2020-02-16 16:50:46,167: INFO Start: Calculating hashes...
100%|█████████████████████████████████████████████████████████████████████████████████████| 2350/2350 [00:03<00:00, 689.70it/s]
2020-02-16 16:50:49,706: INFO End: Calculating hashes!
2020-02-16 16:50:49,708: INFO Start: Evaluating hamming distances for getting duplicates
2020-02-16 16:50:49,708: INFO Start: Retrieving duplicates using Cython Brute force algorithm
100%|███████████████████████████████████████████████████████████████████████████████████████| 14/14 [00:00<00:00, 48690.10it/s]
2020-02-16 16:50:49,848: INFO End: Retrieving duplicates using Cython Brute force algorithm
2020-02-16 16:50:49,848: INFO End: Evaluating hamming distances for getting duplicates

Pip list

Package              Version
-------------------- ----------
absl-py              0.9.0
astor                0.8.1
cachetools           4.0.0
certifi              2019.11.28
chardet              3.0.4
cycler               0.10.0
Cython               0.29.15
gast                 0.2.2
google-auth          1.11.2
google-auth-oauthlib 0.4.1
google-pasta         0.1.8
grpcio               1.27.2
h5py                 2.10.0
idna                 2.8
imagededup           0.2.2
joblib               0.14.1
Keras-Applications   1.0.8
Keras-Preprocessing  1.1.0
kiwisolver           1.1.0
Markdown             3.2.1
matplotlib           3.1.3
numpy                1.16.6
oauthlib             3.1.0
opt-einsum           3.1.0
Pillow               6.2.2
pip                  20.0.2
protobuf             3.11.3
pyasn1               0.4.8
pyasn1-modules       0.2.8
pyparsing            2.4.6
python-dateutil      2.8.1
PyWavelets           1.0.3
requests             2.22.0
requests-oauthlib    1.3.0
rsa                  4.0
scikit-learn         0.22.1
scipy                1.4.1
setuptools           45.2.0
six                  1.14.0
tensorboard          2.0.2
tensorflow-estimator 2.0.1
tensorflow-gpu       2.0.0
termcolor            1.1.0
tqdm                 4.42.1
urllib3              1.25.8
Werkzeug             1.0.0
wheel                0.34.2
wrapt                1.11.2

NVIDIA SMI output

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48                 Driver Version: 410.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    On   | 00000000:01:00.0 Off |                  N/A |
|  0%   50C    P8    15W / 200W |      1MiB /  8117MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

When I run

python -c 'import tensorflow as tf; print(tf.test.is_gpu_available())'

I get

2020-02-16 16:57:57.319386: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-02-16 16:57:57.324196: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3695920000 Hz
2020-02-16 16:57:57.324669: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4b05070 executing computations on platform Host. Devices:
2020-02-16 16:57:57.324693: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
2020-02-16 16:57:57.326121: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-02-16 16:57:57.442858: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.447548: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4bea150 executing computations on platform CUDA. Devices:
2020-02-16 16:57:57.447562: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): GeForce GTX 1070, Compute Capability 6.1
2020-02-16 16:57:57.447694: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.448190: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.7465
pciBusID: 0000:01:00.0
2020-02-16 16:57:57.448388: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-02-16 16:57:57.449189: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-02-16 16:57:57.449862: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2020-02-16 16:57:57.450007: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2020-02-16 16:57:57.450828: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2020-02-16 16:57:57.451509: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2020-02-16 16:57:57.453533: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-02-16 16:57:57.453597: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.454020: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.454393: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-02-16 16:57:57.454416: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-02-16 16:57:57.455013: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-16 16:57:57.455023: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2020-02-16 16:57:57.455029: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2020-02-16 16:57:57.455144: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.455575: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-16 16:57:57.455966: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 7619 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
True

Which shows that my GPU is recognized by tensorflow.

tanujjain commented 4 years ago

Hi

Looking at your code, you are running a hashing algorithm which can not make use of GPU. You will need to use CNN method to do so. Have a look at the documentation: https://idealo.github.io/imagededup/methods/cnn/

philipperemy commented 4 years ago

Ok fair enough!