yinguobing / cnn-facial-landmark

Training code for facial landmark detection based on deep convolutional neural network.
MIT License
623 stars 183 forks source link

help me #102

Closed JanineJang closed 3 years ago

JanineJang commented 3 years ago

Traceback (most recent call last): File "/home/janinejang/cnn-facial-landmark/landmark.py", line 166, in run() File "/home/janinejang/cnn-facial-landmark/landmark.py", line 162, in run mark_model.save(args.export_dir, save_format='tf') File "/home/janinejang/anaconda3/envs/tf01/lib/python3.8/site-packages/tensorflow/python/keras/engine/network.py", line 1051, in save save.save_model(self, filepath, overwrite, include_optimizer, save_format, File "/home/janinejang/anaconda3/envs/tf01/lib/python3.8/site-packages/tensorflow/python/keras/saving/save.py", line 137, in save_model saved_model_save.save(model, filepath, overwrite, include_optimizer, File "/home/janinejang/anaconda3/envs/tf01/lib/python3.8/site-packages/tensorflow/python/keras/saving/saved_model/save.py", line 65, in save saving_utils.raise_model_input_error(model) File "/home/janinejang/anaconda3/envs/tf01/lib/python3.8/site-packages/tensorflow/python/keras/saving/saving_utils.py", line 91, in raise_model_input_error raise ValueError(

### ValueError: Model <model.LandmarkModel object at 0x7feaaa964dc0> cannot be saved because the input shapes have not been set. Usually, input shapes are automatically determined from calling .fit() or .predict(). To manually set the shapes, call model._set_inputs(inputs).

Process finished with exit code 1

I don't know what problem is..I tried README as it is. but it didn't work...

From the repo's root directory

python3 landmark.py \ --model_dir train \ --export_dir saved_model \ --export_only True \ --raw_input True

parser = argparse.ArgumentParser() parser.add_argument('--train_record', default='train.record', type=str, help='Training record file') parser.add_argument('--val_record', default='validation.record', type=str, help='validation record file') parser.add_argument('--model_dir', default='./train', type=str, help='training model directory') parser.add_argument('--log', default='./log', type=str, help='training log directory') parser.add_argument('--export_dir', default='./saved_model', type=str, help='directory to export the saved model') parser.add_argument('--train_steps', default=500, type=int, help='training steps') parser.add_argument('--epochs', default=1, type=int, help='epochs for training') parser.add_argument('--batch_size', default=32, type=int, help='training batch size') parser.add_argument('--export_only', default=True, type=bool, help='Save the model without training and evaluation.') parser.add_argument('--eval_only', default=False, type=bool, help='Do evaluation without training.') parser.add_argument('--raw_input', default=True, type=bool, help='raw input') args = parser.parse_args()

thank you..

yinguobing commented 3 years ago

The exporting part of the latest code is still in development.