bubbliiiing / yolo3-keras

这是一个yolo3-keras的源码,可以用于训练自己的模型。
MIT License
535 stars 188 forks source link

load_model #53

Open lotusdaddy opened 2 years ago

lotusdaddy commented 2 years ago

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

bubbliiiing commented 2 years ago

没有保存整个模型呀

wykykyk commented 1 year ago

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

bubbliiiing commented 1 year ago

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

wykykyk commented 1 year ago

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

bubbliiiing commented 1 year ago

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