Giter VIP home page Giter VIP logo

Comments (6)

Superfloh avatar Superfloh commented on July 24, 2024 1

That looks better already, which pre-trained model version did you take ?

EDIT: Forgot that you trained your own, since I used a pre-trained model with transfer learning.
The error probably has something to do with the tags you used to train the model, as far as I remember it reads the tags.txt to map the model output to the tags. It looks like the tag file you used to train differs from the one you use to evaluate?
Did you train it with 181 tags?
Maybe check the model output dimension and the number of tags your tagfile has.

from deepdanbooru.

DHG-Dav avatar DHG-Dav commented on July 24, 2024 1

OMFG you're right !!! when i last checked the tags i did hit a random key on a new line without noticing it and it screwed everything up !
It works now !!!
Thank you, i was so dumb to didn't even realize the number was related to my tags -_-'
Thanks so much, it's working perfectly now ^^ let's just hope i can train my model again after uninstalling/reinstalling so many times tensorflow-cuda-cudnn and such lol
Thank you very much for you help !

from deepdanbooru.

Superfloh avatar Superfloh commented on July 24, 2024

As far as I know a GPU only supports certain CUDA versions, and the GPU has to be from NVIDIA to support CUDA.
Then you can check which tensorflow version supports what version of CUDA here: https://www.tensorflow.org/install/source#gpu

from deepdanbooru.

DHG-Dav avatar DHG-Dav commented on July 24, 2024

I did check this already, tensorflow-gpu 2.7.0 isn't even mentionned... but i tried with version 2.6.0 and the corresponding cuda version as well...
And yes my gpu is from nvidia and support cuda, it's working well on other machine learning projects (detectron2/imageAI/openpose) with GPU for training and running them. My drivers are up to date as well.
Plus it worked for the training on this one, with GPU, it's just the "evaluate" that doesn't work for some unknown reason.
But thank you for trying to help ^^

from deepdanbooru.

Superfloh avatar Superfloh commented on July 24, 2024

You can try to run

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

To see if it recognizes a GPU at all.
If it detects a GPU you can try to tell tensorflow to use it with
export CUDA_VISIBLE_DEVICES=0 or os.environ['CUDA_VISIBLE_DEVICES'] = '/device:GPU:0'
In case the detected GPU ID isn't 0, you have to edit that as well.

But I think the problem might be Anaconda related.
I had some problems with it as well and ended up using a virtual environment to get it working, but not sure if that actually was the problem.

But maybe KichangKim has a better idea.

from deepdanbooru.

DHG-Dav avatar DHG-Dav commented on July 24, 2024

hmmm i - maybe - fixed my first problem...

I edited evaluate.py : (last line of my copypaste, line 45 of the document)

def evaluate(target_paths, project_path, model_path, tags_path, threshold, allow_gpu, compile_model, allow_folder, folder_filters, verbose):
    if not allow_gpu:
        os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

    if not model_path and not project_path:
        raise Exception('You must provide project path or model path.')

    if not tags_path and not project_path:
        raise Exception('You must provide project path or tags path.')

    target_image_paths = []
    os.environ['CUDA_VISIBLE_DEVICES'] = '0'

But now i still have this error :

(deeptag) PS A:\NN\deeptag\deepdanbooru> deepdanbooru evaluate "A:\TEST\" --project-path "A:\NN\DeepTag\test1" --allow-folder
2021-12-05 17:42:39.020083: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-12-05 17:42:39.514440: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3857 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
Tags of A:\TEST\4cef676d2fd8254ad33e21fe834d8eae.png:
2021-12-05 17:42:46.222645: I tensorflow/stream_executor/cuda/cuda_dnn.cc:366] Loaded cuDNN version 8100
Traceback (most recent call last):
  File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "A:\ANACONDA\envs\deeptag\Scripts\deepdanbooru.exe\__main__.py", line 7, in <module>
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\__main__.py", line 85, in evaluate
    dd.commands.evaluate(target_paths, project_path, model_path, tags_path, threshold, allow_gpu, compile_model, allow_folder, folder_filters, verbose)
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\commands\evaluate.py", line 75, in evaluate
    for tag, score in evaluate_image(image_path, model, tags, threshold):
  File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\commands\evaluate.py", line 27, in evaluate_image
    result_dict[tag] = y[i]
IndexError: index 181 is out of bounds for axis 0 with size 181

from deepdanbooru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.