KichangKim / DeepDanbooru

AI based multi-label girl image classification system, implemented by using TensorFlow.
MIT License
2.65k stars 260 forks source link

run deepdanbooru evaluate on colab #15

Closed kld123509945 closed 4 years ago

kld123509945 commented 4 years ago

Hi, I'm trying to test the deepdanbooru on colab. I have upload the deepdanbooru-v1-20191108-sgd-e30.zip and DeepDanbooru-master on 'drive/Colab Notebooks/' as folders, and upload an image in the test folder. The code is as follows:

!apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}

!mkdir -p drive !google-drive-ocamlfuse drive

import os import sys os.chdir('drive/Colab Notebooks')

!pip install tensorflow>=2.1.0 !pip install Click>=7.0 !pip install numpy>=1.16.2 !pip install scikit-image>=2.22.0 !pip install requests>=0.15.0 !pip install six>=1.13.0

path = "/content/drive/Colab Notebooks/DeepDanbooru master" os.chdir(path)

!python setup.py install

path = "/content/drive/Colab Notebooks" os.chdir(path) !deepdanbooru evaluate deepdanbooru-v1-20191108-sgd-e30 test

However, it stops on the last command and informs as:

Traceback (most recent call last): File "/usr/local/bin/deepdanbooru", line 11, in load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point return ep.load() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2443, in load return self.resolve() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2449, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/init.py", line 1, in File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/init.py", line 4, in File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/train_project.py", line 6, in File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 101, in from tensorflow_core import * File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/init.py", line 40, in from tensorflow.python.tools import module_util as _module_util File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 50, in getattr module = self._load() File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 44, in _load module = _importlib.import_module(self.name) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow ImportError: cannot import name 'pywrap_tensorflow'

Could you help me with this problem? Many thanks!

KichangKim commented 4 years ago

Hi. the evaluate command is changed in latest revision, so your last command should be changed to:

!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30

If test is folder, you need to add --allow-folder option.

!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder

See !deepdanbooru evalaute --help.

Also, try this: https://stackoverflow.com/questions/54172462/tensorflow-wont-import-in-colab

kld123509945 commented 4 years ago

Yeah test is a folder and I upload one image inside it to test the evaluation result. I rewrote the last command as:

!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder

Now this time it stops and says:

Traceback (most recent call last): File "/usr/local/bin/deepdanbooru", line 11, in load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point return ep.load() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2443, in load return self.resolve() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2449, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/init.py", line 1, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/init.py", line 4, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/train_project.py", line 6, in File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 99, in from tensorflow_core import * File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/init.py", line 36, in from tensorflow._api.v1 import compat File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/init.py", line 23, in from tensorflow._api.v1.compat import v1 File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/v1/init.py", line 672, in from tensorflow_estimator.python.estimator.api._v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/init.py", line 10, in from tensorflow_estimator._api.v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/init.py", line 12, in from tensorflow_estimator._api.v1.estimator import inputs File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/inputs/init.py", line 10, in from tensorflow_estimator.python.estimator.inputs.numpy_io import numpy_input_fn File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/numpy_io.py", line 26, in from tensorflow_estimator.python.estimator.inputs.queues import feeding_functions File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py", line 40, in import pandas as pd File "/usr/local/lib/python3.6/dist-packages/pandas/init.py", line 55, in from pandas.core.api import ( File "/usr/local/lib/python3.6/dist-packages/pandas/core/api.py", line 24, in from pandas.core.groupby import Grouper, NamedAgg File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/init.py", line 1, in from pandas.core.groupby.generic import ( # noqa: F401 File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/generic.py", line 44, in from pandas.core.frame import DataFrame File "/usr/local/lib/python3.6/dist-packages/pandas/core/frame.py", line 115, in from pandas.core.series import Series File "/usr/local/lib/python3.6/dist-packages/pandas/core/series.py", line 84, in import pandas.plotting File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/init.py", line 59, in from pandas.plotting._core import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_core.py", line 17, in import pandas.plotting._matplotlib # noqa File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/init.py", line 3, in from pandas.plotting._matplotlib.boxplot import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/boxplot.py", line 14, in from pandas.plotting._matplotlib.core import LinePlot, MPLPlot File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/core.py", line 34, in from pandas.plotting._matplotlib.tools import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/tools.py", line 5, in import matplotlib.table File "/usr/local/lib/python3.6/dist-packages/matplotlib/table.py", line 25, in from .text import Text File "/usr/local/lib/python3.6/dist-packages/matplotlib/text.py", line 14, in from .font_manager import FontProperties File "/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py", line 103, in os.path.join(str(Path.home()), r'AppData\Local\Microsoft\Windows\Fonts'), AttributeError: type object 'Path' has no attribute 'home'

rachmadaniHaryono commented 4 years ago

hi @kld123509945, i'm interested on your error

based on error message & quick google search there is similar error here

https://stackoverflow.com/questions/54934556/pathlib-library-error-in-pathlib-path-home-type-object-path-has-no-attribu

similar issue but directly on matplotlib https://github.com/Sujit-O/pykg2vec/issues/21, where op fixed it by use python3.7 instead of python3.5

kld123509945 commented 4 years ago

Hi @rachmadaniHaryono, thanks for your help

It seems that colab is using python3.6 but not python3.7, see: https://stackoverflow.com/questions/57026465/python-version-doesnt-change-in-colab-when-after-installing-a-different-version

Does this mean that the bug could not be fixed in the next few days? My PC is not very good at training the model as it doesn't have an Nvidia GPU, so I decide to use colab to test the deepdanbooru.

rachmadaniHaryono commented 4 years ago

that stackoverflow gave another alternative

maybe first try simple Path.home, based on op edit

from pathlib import Path
Path.home() 

other than those on SO page, other alternative i can think of is try to organize tensorflow import so it will not import everything and hope that matplotlib will not try to use Path.home


e:

>>> from pathlib import Path
>>> Path.home() 
PosixPath('/root')
rachmadaniHaryono commented 4 years ago

i recommend

...
path = "/content/drive/Colab Notebooks"
os.chdir(path)
# put it here
from pathlib import Path
print(Path.home())
!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder

i add print just in case that collab will skip the output of Path.home

e: also those are python code so it is not started with exclamation mark

e2: i was wrong in the edit

kld123509945 commented 4 years ago

I rewrote the code:

path = "/content/drive/Colab Notebooks" os.chdir(path) from pathlib import Path print(Path.home()) !deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder

and it still reports:

/root Traceback (most recent call last): File "/usr/local/bin/deepdanbooru", line 11, in load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point return ep.load() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2443, in load return self.resolve() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2449, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/init.py", line 1, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/init.py", line 4, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/train_project.py", line 6, in File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 99, in from tensorflow_core import * File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/init.py", line 36, in from tensorflow._api.v1 import compat File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/init.py", line 23, in from tensorflow._api.v1.compat import v1 File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/v1/init.py", line 672, in from tensorflow_estimator.python.estimator.api._v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/init.py", line 10, in from tensorflow_estimator._api.v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/init.py", line 12, in from tensorflow_estimator._api.v1.estimator import inputs File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/inputs/init.py", line 10, in from tensorflow_estimator.python.estimator.inputs.numpy_io import numpy_input_fn File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/numpy_io.py", line 26, in from tensorflow_estimator.python.estimator.inputs.queues import feeding_functions File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py", line 40, in import pandas as pd File "/usr/local/lib/python3.6/dist-packages/pandas/init.py", line 55, in from pandas.core.api import ( File "/usr/local/lib/python3.6/dist-packages/pandas/core/api.py", line 24, in from pandas.core.groupby import Grouper, NamedAgg File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/init.py", line 1, in from pandas.core.groupby.generic import ( # noqa: F401 File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/generic.py", line 44, in from pandas.core.frame import DataFrame File "/usr/local/lib/python3.6/dist-packages/pandas/core/frame.py", line 115, in from pandas.core.series import Series File "/usr/local/lib/python3.6/dist-packages/pandas/core/series.py", line 84, in import pandas.plotting File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/init.py", line 59, in from pandas.plotting._core import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_core.py", line 17, in import pandas.plotting._matplotlib # noqa File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/init.py", line 3, in from pandas.plotting._matplotlib.boxplot import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/boxplot.py", line 14, in from pandas.plotting._matplotlib.core import LinePlot, MPLPlot File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/core.py", line 34, in from pandas.plotting._matplotlib.tools import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/tools.py", line 5, in import matplotlib.table File "/usr/local/lib/python3.6/dist-packages/matplotlib/table.py", line 25, in from .text import Text File "/usr/local/lib/python3.6/dist-packages/matplotlib/text.py", line 14, in from .font_manager import FontProperties File "/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py", line 103, in os.path.join(str(Path.home()), r'AppData\Local\Microsoft\Windows\Fonts'), AttributeError: type object 'Path' has no attribute 'home'

rachmadaniHaryono commented 4 years ago
...
!from pathlib import Path
!print(Path.home())
...

write without exclamation mark

...
from pathlib import Path
print(Path.home())
...

if it is the error, it will raise error on this line AttributeError: type object 'Path' has no attribute 'home'

rachmadaniHaryono commented 4 years ago

ok, so the original Path.home run fine

next is checking the matplotlib version, pathlib version and sys.path

...
from pathlib import Path
print(Path.home())
!pip show pathlib
!pip show matplotlib
import sys
sys.path
!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder
kld123509945 commented 4 years ago

ok, so the original Path.home run fine

next is checking the matplotlib version, pathlib version and sys.path

...
from pathlib import Path
print(Path.home())
!pip show pathlib
!pip show matplotlib
import sys
sys.path
!deepdanbooru evaluate test --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder

I have rewrote these codes like this, and the report is:

/root Name: pathlib Version: 1.0.1 Summary: Object-oriented filesystem paths Home-page: https://pathlib.readthedocs.org/ Author: Antoine Pitrou Author-email: solipsis@pitrou.net License: MIT License Location: /usr/local/lib/python3.6/dist-packages Requires: Required-by: Name: matplotlib Version: 3.1.2 Summary: Python plotting package Home-page: https://matplotlib.org Author: John D. Hunter, Michael Droettboom Author-email: matplotlib-users@python.org License: PSF Location: /usr/local/lib/python3.6/dist-packages Requires: numpy, cycler, kiwisolver, python-dateutil, pyparsing Required-by: yellowbrick, stable-baselines, seaborn, scikit-image, plotnine, pandas-profiling, mlxtend, mizani, missingno, matplotlib-venn, magenta, keras-vis, imgaug, fbprophet, fastai, descartes, daft Traceback (most recent call last): File "/usr/local/bin/deepdanbooru", line 11, in load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point return ep.load() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2443, in load return self.resolve() File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2449, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/init.py", line 1, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/init.py", line 4, in File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/train_project.py", line 6, in File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 99, in from tensorflow_core import * File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/init.py", line 36, in from tensorflow._api.v1 import compat File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/init.py", line 23, in from tensorflow._api.v1.compat import v1 File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/compat/v1/init.py", line 672, in from tensorflow_estimator.python.estimator.api._v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/init.py", line 10, in from tensorflow_estimator._api.v1 import estimator File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/init.py", line 12, in from tensorflow_estimator._api.v1.estimator import inputs File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/_api/v1/estimator/inputs/init.py", line 10, in from tensorflow_estimator.python.estimator.inputs.numpy_io import numpy_input_fn File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/numpy_io.py", line 26, in from tensorflow_estimator.python.estimator.inputs.queues import feeding_functions File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py", line 40, in import pandas as pd File "/usr/local/lib/python3.6/dist-packages/pandas/init.py", line 55, in from pandas.core.api import ( File "/usr/local/lib/python3.6/dist-packages/pandas/core/api.py", line 24, in from pandas.core.groupby import Grouper, NamedAgg File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/init.py", line 1, in from pandas.core.groupby.generic import ( # noqa: F401 File "/usr/local/lib/python3.6/dist-packages/pandas/core/groupby/generic.py", line 44, in from pandas.core.frame import DataFrame File "/usr/local/lib/python3.6/dist-packages/pandas/core/frame.py", line 115, in from pandas.core.series import Series File "/usr/local/lib/python3.6/dist-packages/pandas/core/series.py", line 84, in import pandas.plotting File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/init.py", line 59, in from pandas.plotting._core import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_core.py", line 17, in import pandas.plotting._matplotlib # noqa File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/init.py", line 3, in from pandas.plotting._matplotlib.boxplot import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/boxplot.py", line 14, in from pandas.plotting._matplotlib.core import LinePlot, MPLPlot File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/core.py", line 34, in from pandas.plotting._matplotlib.tools import ( File "/usr/local/lib/python3.6/dist-packages/pandas/plotting/_matplotlib/tools.py", line 5, in import matplotlib.table File "/usr/local/lib/python3.6/dist-packages/matplotlib/table.py", line 25, in from .text import Text File "/usr/local/lib/python3.6/dist-packages/matplotlib/text.py", line 14, in from .font_manager import FontProperties File "/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py", line 103, in os.path.join(str(Path.home()), r'AppData\Local\Microsoft\Windows\Fonts'), AttributeError: type object 'Path' has no attribute 'home'

KichangKim commented 4 years ago

Try below command instead of !deepdanbooru

!python -m deepdanbooru
rachmadaniHaryono commented 4 years ago

what i notice from pip show pathlib that it use external pathlib library

see the note on documentation

This module has been included in the Python 3.4 standard library after PEP 428 acceptance. You only need to install it for Python 3.3 or older.

e: doc url https://pathlib.readthedocs.io/en/pep428/

kld123509945 commented 4 years ago

Try below command instead of !deepdanbooru

!python -m deepdanbooru

@KichangKim I‘m running the last section as:

path = "/content/drive/Colab Notebooks" os.chdir(path) !python -m deepdanbooru evaluate --project-path deepdanbooru-v1-20191108-sgd-e30 --allow-folder test

And it reports:

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version. Instructions for updating: If using Keras pass _constraint arguments to layers. 2020-01-29 14:39:40.171190: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1 2020-01-29 14:39:40.174073: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected 2020-01-29 14:39:40.174149: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: 6461db61d544 2020-01-29 14:39:40.174175: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: 6461db61d544 2020-01-29 14:39:40.174276: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200] libcuda reported version is: 418.67.0 2020-01-29 14:39:40.174334: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204] kernel reported version is: 418.67.0 2020-01-29 14:39:40.174356: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:310] kernel version seems to match DSO: 418.67.0 2020-01-29 14:39:40.179986: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2200000000 Hz 2020-01-29 14:39:40.180220: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x28394700 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-01-29 14:39:40.180282: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Tags of /content/drive/Colab Notebooks/test/Copy of 81silver811-1010150973380018177-20180622_212214-img3.jpg: Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/main.py", line 88, in File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/main.py", line 84, in evaluate File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/evaluate.py", line 74, in evaluate File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/evaluate.py", line 17, in evaluate_image File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/data/init.py", line 23, in load_image_for_evaluate AttributeError: 'Tensor' object has no attribute 'numpy'

KichangKim commented 4 years ago

It seems that colab's tensorflow is old and you should upgrade mode install it.

Here is complete sample notebook for executing DeenDanbooru on colab. https://colab.research.google.com/drive/1BOSYlrWzBHI60NCZF18PIdmwVgsy2tCT

kld123509945 commented 4 years ago

Solved! It successfully runs. Thanks so much for your help!@KichangKim @rachmadaniHaryono