转移学习问题:使用我自己的训练的权重,或者是USIIGACI训练有素的MRCNN(Matterport实施)

发布于 2025-02-07 07:54:02 字数 979 浏览 3 评论 0原文

我的项目涉及细胞检测,所以我想我尝试使用 usiigaci预先训练的权重 。 但是,当我尝试时,我会收到以下错误: valueerror:第362页(命名为“锚”)期望1个权重,但是保存的权重为0个元素。 例如,该培训适合预估计的可可丝。 这是我用来加载权重的代码:

model = MaskRCNN(mode='training', model_dir='./', config=config) model.load_weights('Usiigaci_3.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])

在尝试加载通过自己的照片训练我的模型生成的权重时,我也会遇到类似的问题,继续我上次停止的训练。 收到的错误是:

ValueError: Layer #362 (named "anchors"), weight <tf.Variable 'Variable:0' shape=(4, 261888, 4) dtype=float32> has shape (4, 261888, 4), but the saved weight has shape (2, 261888, 4).

加载权重:

model.load_weights('new_weigths/40_epochs/mask_rcnn_cell_cfg_0040.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])

如果您了解为什么会发生这种情况,请告诉我。 谢谢!!

my project involves cell detection, so I thought I'd try training my NN using Usiigaci pre-trained weights.
but when I try I get the following error:
ValueError: Layer #362 (named "anchors") expects 1 weight(s), but the saved weights have 0 element(s).
The training works fine for pretrained coco weigths for example.
this is the code i use to load the weights:

model = MaskRCNN(mode='training', model_dir='./', config=config) model.load_weights('Usiigaci_3.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])

I also get a similar problem when trying to load the weights that were generated by training my model over my own photos, to continue the training where I stopped the last time.
the error received is:

ValueError: Layer #362 (named "anchors"), weight <tf.Variable 'Variable:0' shape=(4, 261888, 4) dtype=float32> has shape (4, 261888, 4), but the saved weight has shape (2, 261888, 4).

loading the weights:

model.load_weights('new_weigths/40_epochs/mask_rcnn_cell_cfg_0040.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])

please let me know if you understand why is this happening.
thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文