Coder Social home page Coder Social logo

Comments (13)

iamstarlee avatar iamstarlee commented on September 24, 2024

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

Traceback (most recent call last):
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 186, in
run_inference(args)
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 128, in run_inference
model.load_state_dict(updated_state_dict)
File "C:\ProgramData\anaconda3\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 2152, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Xie2019:
Missing key(s) in state_dict: "features.5.weight", "features.5.bias", "features.8.weight", "features.8.bias".
Unexpected key(s) in state_dict: "features.3.weight", "features.3.bias", "features.6.weight", "features.6.bias".
size mismatch for features.0.weight: copying a param with shape torch.Size([64, 3, 11, 11]) from checkpoint, the shape in current model is torch.Size([64, 11, 11, 11]).

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

还有就是训练好的模型是不是都是ckpt格式的,但是我的输出是名称是events.out.tfevents.1714136754.PC-202310272034,导致加载模型时报错:Traceback (most recent call last):
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 186, in
run_inference(args)
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 111, in run_inference
updated_state_dict, model_name, num_classes, training_mode, br_defect = load_model(model_path, best_weights)
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 69, in load_model
model_last_ckpt = torch.load(last_ckpt_path)
File "C:\ProgramData\anaconda3\envs\torch\lib\site-packages\torch\serialization.py", line 1028, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\ProgramData\anaconda3\envs\torch\lib\site-packages\torch\serialization.py", line 1246, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\x18'.

from multi-label-sewer-classification.

iamstarlee avatar iamstarlee commented on September 24, 2024

from multi-label-sewer-classification.

iamstarlee avatar iamstarlee commented on September 24, 2024

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

请问那这两个问题应该怎样解决呢

from multi-label-sewer-classification.

iamstarlee avatar iamstarlee commented on September 24, 2024

你把你的模型结构代码和推理代码贴出来,我瞅瞅

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

可以给一下邮箱,通过邮箱发送吗

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

已发送谢谢

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

请问收到邮件了吗

from multi-label-sewer-classification.

iamstarlee avatar iamstarlee commented on September 24, 2024

image
image

  1. 模型应该加载你保存的ckpt
  2. 前向传播这可以直接add
  3. 你修改的模型是放在sewer_models.py或者ml_models.py里的吗?因为我没看到你的调用

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

1.加载events.out.tfevents格式的还是会报错:Traceback (most recent call last):
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 187, in
run_inference(args)
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 112, in run_inference
updated_state_dict, model_name, num_classes, training_mode, br_defect = load_model(model_path, best_weights)
File "E:\Multi-label-Sewer-Classification-main\inference.py", line 70, in load_model
model_last_ckpt = torch.load(last_ckpt_path)
File "C:\ProgramData\anaconda3\envs\torch\lib\site-packages\torch\serialization.py", line 1028, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\ProgramData\anaconda3\envs\torch\lib\site-packages\torch\serialization.py", line 1246, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\x18'.
但是测试ckpt的文件却能成功
2.前向传播是之前像用注意力机制融合但是没成功所以用的add
3.你是说训练完成events.out.tfevents格式的模型文件吗

from multi-label-sewer-classification.

qianmeng19 avatar qianmeng19 commented on September 24, 2024

我可以给你我的模型文件请问能帮我解决吗

from multi-label-sewer-classification.

Related Issues (11)

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.