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

载入模型报错 #25

Open
lhcezx opened this issue Nov 11, 2021 · 1 comment
Open

载入模型报错 #25

lhcezx opened this issue Nov 11, 2021 · 1 comment

Comments

@lhcezx
Copy link

lhcezx commented Nov 11, 2021

博主你好,

我在运行你的train_model的时候在已经将模型放到weights后,运行到model.load_weights('weights/faster_rcnn.h5', by_name = True)这行报错 ValueError: Unable to load weights saved in HDF5 format into a subclassed Model which has not created its variables yet. Call the Model first, then load the weights. 可以请教您一下吗?

@lhcezx
Copy link
Author

lhcezx commented Nov 11, 2021

我尝试使用model.built = True使这个问题不再报错,但是接下来在训练的 model((batch_imgs, batch_metas, batch_bboxes, batch_labels), training=True)这行会报错,
indices[192] = [192, -1] does not index into shape [256,81,4] [Op:TensorScatterUpdate]

During handling of the above exception, another exception occurred:

File "C:\Users\lhcez\Desktop\tf-eager-fasterrcnn-master\tf-eager-fasterrcnn-master\detection\core\bbox\bbox_target.py", line 179, in _build_single_target
delta_targets = tf.tensor_scatter_nd_update(tile_delta_targets, ids, delta_targets) # [num_rois, self.num_classes, 4]
File "C:\Users\lhcez\Desktop\tf-eager-fasterrcnn-master\tf-eager-fasterrcnn-master\detection\core\bbox\bbox_target.py", line 72, in build_targets
rois, labels, label_weights, delta_targets, delta_weights = self._build_single_target(
File "C:\Users\lhcez\Desktop\tf-eager-fasterrcnn-master\tf-eager-fasterrcnn-master\detection\models\detectors\faster_rcnn.py", line 126, in call
self.bbox_target.build_targets(
File "C:\Users\lhcez\Desktop\tf-eager-fasterrcnn-master\tf-eager-fasterrcnn-master\train.py", line 63, in
model((batch_imgs, batch_metas, batch_bboxes, batch_labels), training=True)

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

1 participant