Detectron2中运行demo.py时,报错:AssertionError: get_event_storage() has to be called inside a ‘with EventSt

在运行模型的demo时遇到一个错误,具体是AssertionError:get_event_storage()必须在一个withEventStorage(...)上下文中调用。为解决此问题,需要修改roi_heads.py文件,将直接调用storage=get_event_storage()的部分改为使用with语句包围,如:withEventStorage():storage=get_event_storage()。这个问题的解决方案参考自GitHub上的FSCE项目issue#37。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述

训练完模型以后,运行demo/demo.py去可视化结果,结果报错:

python demo/demo.py --config-file configs/PASCAL_VOC/base-training/R101_FPN_base_training_split1.yml \--input input1.jpg


# 报错:

AssertionError: get_event_storage() has to be called inside a 'with EventStorage(...)' context!

解决方案


roi_ heads.py中的

storage = get_ event_storage () 

改为

with EventStorage():
	storage = get_event_storage()

参考文献:
https://github.com/megvii-research/FSCE/issues/37

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

布尔大学士

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值