tf-eager-fasterrcnn icon indicating copy to clipboard operation
tf-eager-fasterrcnn copied to clipboard

载入模型报错

Open lhcezx opened this issue 2 years ago • 1 comments

博主你好,

我在运行你的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 avatar Nov 11 '21 19:11 lhcezx

我尝试使用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)

lhcezx avatar Nov 11 '21 19:11 lhcezx