GithubHelp home page GithubHelp logo

Comments (7)

xinyu1205 avatar xinyu1205 commented on May 28, 2024 2

你好我运行测试命令的时候报错,请问您有遇到吗:python inference_tag2text.py --image 042.jpg --pretrained tag2text_swin_14m.pth 报错: magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

你的这个报错我没有遇到,我倒是遇到了另一个报错

Traceback (most recent call last):
  File "inference_tag2text.py", line 94, in <module>
    res = inference(image, model, args.specified_tags)
  File "inference_tag2text.py", line 43, in inference
    caption, tag_predict = model.generate(image,
  File "/data2/home/tyu/stable_diffusion/promt_gen/Recognize_Anything-Tag2Text/models/tag2text.py", line 364, in generate
    torch.sigmoid(logits) > self.class_threshold,
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

因为我是在显卡上跑的,所以遇到这样的报错,可以通过将对应的代码

https://github.com/xinyu1205/Recognize_Anything-Tag2Text/blob/ffd1a283caea70ab8436645c0fd0f366ae7de3f8/models/tag2text.py#L364

修改为

torch.sigmoid(logits) > self.class_threshold.to(image.device),

就行了,小问题 @Coler1994 @xinyu1205

感谢你非常有价值的bug反馈,我已经修改对应的代码~

from recognize-anything.

onefish51 avatar onefish51 commented on May 28, 2024 1

你好我运行测试命令的时候报错,请问您有遇到吗:python inference_tag2text.py --image 042.jpg --pretrained tag2text_swin_14m.pth 报错: magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

你的这个报错我没有遇到,我倒是遇到了另一个报错

Traceback (most recent call last):
  File "inference_tag2text.py", line 94, in <module>
    res = inference(image, model, args.specified_tags)
  File "inference_tag2text.py", line 43, in inference
    caption, tag_predict = model.generate(image,
  File "/data2/home/tyu/stable_diffusion/promt_gen/Recognize_Anything-Tag2Text/models/tag2text.py", line 364, in generate
    torch.sigmoid(logits) > self.class_threshold,
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

因为我是在显卡上跑的,所以遇到这样的报错,可以通过将对应的代码
https://github.com/xinyu1205/Recognize_Anything-Tag2Text/blob/ffd1a283caea70ab8436645c0fd0f366ae7de3f8/models/tag2text.py#L364

修改为

torch.sigmoid(logits) > self.class_threshold.to(image.device),

就行了,小问题
@Coler1994 @xinyu1205

from recognize-anything.

majinyu666 avatar majinyu666 commented on May 28, 2024 1

model.threshold由0.68降到了0.64?我刚才改了但是好像没起到作用。还是其他哪个参数?谢谢

应该只是阈值问题,我这儿降到0.63能出lampdoor还要更低些

from recognize-anything.

Coler1994 avatar Coler1994 commented on May 28, 2024

demo为了保证准确率,调高了阈值,牺牲了些召回,
grounded sam的pipeline由于有grounding dino兜底,阈值会偏低些。
我们在精细的调调每个类的阈值。

from recognize-anything.

onefish51 avatar onefish51 commented on May 28, 2024

model.threshold由0.68降到了0.64?我刚才改了但是好像没起到作用。还是其他哪个参数?谢谢

from recognize-anything.

cpperrpr avatar cpperrpr commented on May 28, 2024

你好我运行测试命令的时候报错,请问您有遇到吗:python inference_tag2text.py --image 042.jpg --pretrained tag2text_swin_14m.pth
报错:
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.

from recognize-anything.

cpperrpr avatar cpperrpr commented on May 28, 2024

你好我运行测试命令的时候报错,请问您有遇到吗:python inference_tag2text.py --image 042.jpg --pretrained tag2text_swin_14m.pth 报错: magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

你的这个报错我没有遇到,我倒是遇到了另一个报错

Traceback (most recent call last):
  File "inference_tag2text.py", line 94, in <module>
    res = inference(image, model, args.specified_tags)
  File "inference_tag2text.py", line 43, in inference
    caption, tag_predict = model.generate(image,
  File "/data2/home/tyu/stable_diffusion/promt_gen/Recognize_Anything-Tag2Text/models/tag2text.py", line 364, in generate
    torch.sigmoid(logits) > self.class_threshold,
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

因为我是在显卡上跑的,所以遇到这样的报错,可以通过将对应的代码

https://github.com/xinyu1205/Recognize_Anything-Tag2Text/blob/ffd1a283caea70ab8436645c0fd0f366ae7de3f8/models/tag2text.py#L364

修改为

torch.sigmoid(logits) > self.class_threshold.to(image.device),

就行了,小问题 @Coler1994 @xinyu1205

谢谢,发现问题了是模型文件没clone好,谢谢你的回复

from recognize-anything.

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.