yolo3-keras icon indicating copy to clipboard operation
yolo3-keras copied to clipboard

load_model

Open lotusdaddy opened this issue 2 years ago • 6 comments

lotusdaddy avatar Mar 27 '22 06:03 lotusdaddy

训练好的模型执行load_model时报错“NameError: name 'get_anchors_and_decode' is not defined”

lotusdaddy avatar Mar 27 '22 06:03 lotusdaddy

没有保存整个模型呀

bubbliiiing avatar Mar 27 '22 14:03 bubbliiiing

请问要怎么保存整个模型呀?我也遇到到了这个问题,但是我在train.py已经修改成save_weights_only=False,即在./nets/callbacks.py设置为了model.save(..),而不是model.save_weights(..),训练之后还是报同样的错误。

wykykyk avatar Mar 24 '23 06:03 wykykyk

额nets/callbacks.py这里应该没保存get_anchors_and_decode呀,你报错看看

bubbliiiing avatar Mar 27 '23 17:03 bubbliiiing

Traceback (most recent call last): File "h5_convert_to_pb.py", line 71, in h5_model = keras.models.load_model(model_file) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper return load_function(*args, **kwargs) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\saving.py", line 584, in load_model model = _deserialize_model(h5dict, custom_objects, compile) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\saving.py", line 274, in deserialize_model model = model_from_config(model_config, custom_objects=custom_objects) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\saving.py", line 627, in model_from_config return deserialize(config, custom_objects=custom_objects) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\layers_init.py", line 168, in deserialize printable_module_name='layer') File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object list(custom_objects.items()))) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\network.py", line 1075, in from_config process_node(layer, node_data) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\network.py", line 1025, in process_node layer(unpack_singleton(input_tensors), **kwargs) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\engine\base_layer.py", line 489, in call output = self.call(inputs, **kwargs) File "C:\Anaconda3\envs\vitis-ai1.2\lib\site-packages\keras\layers\core.py", line 716, in call return self.function(inputs, **arguments) File "C:\Users\XXX\Desktop\yolov7-tiny-keras-master\nets\yolo_training.py", line 177, in yolo_loss grid, raw_pred, pred_xy, pred_wh = get_anchors_and_decode(yolo_outputs[l], NameError: name 'get_anchors_and_decode' is not defined

wykykyk avatar Apr 06 '23 10:04 wykykyk

额,要么在预测那个部分保存吧,不要再train保存整个模型

bubbliiiing avatar Apr 07 '23 14:04 bubbliiiing