Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法测试,TypeError: __init__() missing 1 required positional argument: 'hps_channel' #15

Open
Yuhyeong opened this issue Apr 13, 2023 · 3 comments

Comments

@Yuhyeong
Copy link

由于本人远程实验室的机器,且没有root权限,所以无法使用您准备脚本配置环境,故均按照你的脚本改了改,现在在最后测试的时候出现这样的问题

python test.py multi_pose_wodet --exp_id coco512 --dataset coco_hp_wodet --resume --not_reg_offset --not_reg_hp_offset --K 20 --not_hm_hp --arch dla_34 --input_res 512 --keep_res
Keep resolution testing.
training chunk_sizes: [32]
The output will be saved to /home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet/coco512
heads {'hm': 1, 'hps': 34}
Namespace(K=20, aggr_weight=0.0, agnostic_ex=False, arch='dla_34', aug_ddd=0.5, aug_rot=0, batch_size=32, cat_spec_wh=False, center_thresh=0.1, chunk_sizes=[32], data_dir='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../data', dataset='coco_hp_wodet', debug=0, debug_dir='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet/coco512/debug', debugger_theme='white', demo='/home/users/yabo.xiao/CNet_v2/img', dense_hp=False, dense_wh=False, dep_weight=1, dim_weight=1, down_ratio=4, eval_oracle_dep=False, eval_oracle_hm=False, eval_oracle_hmhp=False, eval_oracle_hp_offset=False, eval_oracle_kps=False, eval_oracle_offset=False, eval_oracle_wh=False, exp_dir='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet', exp_id='coco512', fix_res=False, flip=0.5, flip_idx=[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]], flip_test=False, giou=False, giou_weight=1.0, gpus=[0], gpus_str='0', head_conv=256, heads={'hm': 1, 'hps': 34}, hide_data_time=False, hm_hp=False, hm_hp_weight=1, hm_weight=1, hp_weight=1, input_h=512, input_res=512, input_w=512, keep_res=True, kitti_split='3dop', load_model='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet/coco512/model_last.pth', lr=0.000125, lr_step=[90, 120], master_batch_size=32, mean=array([[[0.40789655, 0.44719303, 0.47026116]]], dtype=float32), metric='loss', mse_loss=False, nms=False, no_color_aug=False, norm_wh=False, not_cuda_benchmark=False, not_hm_hp=True, not_prefetch_test=False, not_rand_crop=False, not_reg_bbox=False, not_reg_hp_offset=True, not_reg_offset=True, num_classes=1, num_epochs=140, num_iters=-1, num_stacks=1, num_workers=4, off_weight=1, output_h=128, output_path='/opt/tiger/adaptivepose', output_res=128, output_w=128, pad=31, peak_thresh=0.2, print_iter=0, rect_mask=False, reg_bbox=True, reg_hp_offset=False, reg_loss='l1', reg_offset=False, resume=True, root_dir='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../..', rot_weight=1, rotate=0, save_all=False, save_dir='/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet/coco512', scale=0.4, scores_thresh=0.1, seed=317, shift=0.1, std=array([[[0.2886383 , 0.27408165, 0.27809834]]], dtype=float32), task='multi_pose_wodet', test=False, test_scales=[1.0], trainval=False, val_intervals=1, vis_thresh=0.3, wh_weight=0.1)
==> initializing coco 2017 val data.
loading annotations into memory...
Done (t=0.35s)
creating index...
index created!
Loaded val 5000 samples
Creating model...
backbone_Params: 19.72M
Traceback (most recent call last):
File "test.py", line 134, in
prefetch_test(opt)
File "test.py", line 58, in prefetch_test
detector = Detector(opt)
File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/detectors/multi_pose_wodet.py", line 26, in init
super(MultiPoseDetector_wodet, self).init(opt)
File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/detectors/base_detector.py", line 24, in init
self.model = create_model(opt.arch, opt.heads, opt.head_conv, is_train=False)
File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/models/model.py", line 30, in create_model
model = get_model(num_layers=num_layers, heads=heads, head_conv=head_conv)
File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/models/networks/pose_dla_dcn_v2.py", line 562, in get_pose_net
head_conv=head_conv)
File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/models/networks/pose_dla_dcn_v2.py", line 528, in init
self.sampler = Feat_sampler(head_conv)
TypeError: init() missing 1 required positional argument: 'hps_channel'

@buptxyb666
Copy link
Owner

ok了

@Yuhyeong
Copy link
Author

上面的问题解决了哥,但是下面有一些其他的问题。劳烦您看一下

test.py中一开始我没指定权重,然后出现了这个报错

FileNotFoundError: [Errno 2] No such file or directory: '/home/renyouheng/AI_Code/AdaptivePose/src/lib/../../exp/multi_pose_wodet/coco512/model_last.pth'

之后我加入了 --load_model,没出问题,但是又出现下面的问题

Traceback (most recent call last):
  File "test.py", line 134, in <module>
    prefetch_test(opt)
  File "test.py", line 58, in prefetch_test
    detector = Detector(opt)
  File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/detectors/multi_pose_wodet.py", line 26, in __init__
    super(MultiPoseDetector_wodet, self).__init__(opt)
  File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/detectors/base_detector.py", line 25, in __init__
    self.model = load_model(self.model, opt.load_model)
  File "/home/renyouheng/AI_Code/AdaptivePose/src/lib/models/model.py", line 37, in load_model
    print('loaded {}, epoch {}'.format(model_path, checkpoint['epoch']))
KeyError: 'epoch'

接着我传入了--num_epochs 1,但是还是出现了这个错误。
为什么在测试中需要指定epoch呀铁铁

@buptxyb666
Copy link
Owner

指定载入模型在这里写定了

opt.load_model = os.path.join(model_path, 'model_last.pth')

你可以在这稍微修改下,改成可传参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants