automl icon indicating copy to clipboard operation
automl copied to clipboard

inference error

Open gtgtgt1117 opened this issue 6 years ago • 8 comments

@Jupanlee

Hello,我想请问一下,我inference出现的错误是什么原因,以下是我的训练命令和inference命令

train : python main.py -mode=train --num_classer=53 --training_file_pattern=tfrecord/train-000* --model_name=efficientdet-d0 --model_dir=model --ckpt=efficientdet-d0 --train_batch_size=32 --eval_batch_size=8 --eval_samples=1024 --num_examples_per_epoch=1619 --num_epochs=2 --hparams="use_bfloat16=false,num_classes=53,moving_average_decay=0" --use_tpu=False

inference: python model_inspect.py --runmode=infer --model_name=efficientdet-d0 --ckpt_path=./model --max_boxes_to_draw=100 --min_score_thresh=0.2 --input_image=../automl/efficientdet/car01.jpeg --output_image_dir=tmp/ --num_classes=53 --input_image_size=512

inference error: 2020-04-16 18:15:19.945517: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint Traceback (most recent call last): File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found. (0) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] (1) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

gtgtgt1117 avatar Apr 17 '20 02:04 gtgtgt1117

Hello,

ExponentialMovingAverage not found in checkpoint

Try the flag --enable_ema=False for inference. This seems to be a similar issue : https://github.com/google/automl/issues/249

DamGameHero avatar Apr 17 '20 08:04 DamGameHero

python model_inspect.py --runmode=infer model_name=efficientdet-d0 --ckpt_path=efficientdet-d0 input_image_size=512 --max_boxes_to_draw=100 --min_score_thresh=0.2 --line_thickness=4 --saved_model_dir=/tmp/saved_model --input_image=img.png --output_image_dir=/tmp/ --enable_ema=False

I also tried python model_inspect.py --runmode=infer model_name=efficientdet-d0 --ckpt_path=efficientdet-d0 input_image_size=512 --max_boxes_to_draw=100 --min_score_thresh=0.2 --line_thickness=4 --saved_model_dir=/tmp/saved_model --input_image=img.png --output_image_dir=/tmp/ --enable_ema=False --num_classes=90

Still gives me an error

Key efficientnet-b1/blocks_0/conv2d/kernel not found in checkpoint [[node save/RestoreV2 (defined at /mnt/efficientdet/inference.py:144) ]]

Original stack trace for 'save/RestoreV2': File "model_inspect.py", line 408, in tf.app.run(main) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run _run_main(main, args) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main sys.exit(main(argv)) File "model_inspect.py", line 402, in main inspector.run_model(FLAGS.runmode, FLAGS.threads) File "model_inspect.py", line 374, in run_model FLAGS.input_image, FLAGS.output_image_dir, **config_dict) File "model_inspect.py", line 248, in inference_single_image driver.inference(image_image_path, output_dir, **kwargs) File "/mnt/efficientdet/inference.py", line 607, in inference sess, self.ckpt_path, enable_ema=self.enable_ema, export_ckpt=None) File "/mnt/efficientdet/inference.py", line 144, in restore_ckpt saver = tf.train.Saver(var_dict, max_to_keep=1) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 828, in init self.build() File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 840, in build self._build(self._filename, build_save=True, build_restore=True) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 878, in _build build_restore=build_restore) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 508, in _build_internal restore_sequentially, reshape) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 328, in _AddRestoreOps restore_sequentially) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 575, in bulk_restore return io_ops.restore_v2(filename_tensor, names, slices, dtypes) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_io_ops.py", line 1506, in restore_v2 name=name) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py", line 742, in _apply_op_helper attrs=attr_protos, op_def=op_def) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 3322, in _create_op_internal op_def=op_def) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 1756, in init self._traceback = tf_stack.extract_stack()

varghesealex90 avatar Apr 17 '20 10:04 varghesealex90

你更新一下代码看看,inference时候需要设置 --enable_ema=False

gtgtgt1117 [email protected] 于2020年4月17日周五 上午10:00写道:

@Jupanlee https://github.com/Jupanlee

Hello,我想请问一下,我inference出现的错误是什么原因,以下是我的训练命令和inference命令

train : python main.py -mode=train --num_classer=53 --training_file_pattern=tfrecord/train-000* --model_name=efficientdet-d0 --model_dir=model --ckpt=efficientdet-d0 --train_batch_size=32 --eval_batch_size=8 --eval_samples=1024 --num_examples_per_epoch=1619 --num_epochs=2 --hparams="use_bfloat16=false,num_classes=53,moving_average_decay=0" --use_tpu=False

inference: python model_inspect.py --runmode=infer --model_name=efficientdet-d0 --ckpt_path=./model --max_boxes_to_draw=100 --min_score_thresh=0.2 --input_image=../automl/efficientdet/car01.jpeg --output_image_dir=tmp/ --num_classes=53 --input_image_size=512

inference error: 2020-04-16 18:15:19.945517: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint Traceback (most recent call last): File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found. (0) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] (1) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/automl/issues/252, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEAD5FRDLYNZOE6ZRINGTB3RM6Z47ANCNFSM4MKMABMQ .

Jupanlee avatar Apr 22 '20 01:04 Jupanlee

Hello, I have encountered the same problem as you. Have you solved it

@Jupanlee

Hello,我想请问一下,我inference出现的错误是什么原因,以下是我的训练命令和inference命令

train : python main.py -mode=train --num_classer=53 --training_file_pattern=tfrecord/train-000* --model_name=efficientdet-d0 --model_dir=model --ckpt=efficientdet-d0 --train_batch_size=32 --eval_batch_size=8 --eval_samples=1024 --num_examples_per_epoch=1619 --num_epochs=2 --hparams="use_bfloat16=false,num_classes=53,moving_average_decay=0" --use_tpu=False

inference: python model_inspect.py --runmode=infer --model_name=efficientdet-d0 --ckpt_path=./model --max_boxes_to_draw=100 --min_score_thresh=0.2 --input_image=../automl/efficientdet/car01.jpeg --output_image_dir=tmp/ --num_classes=53 --input_image_size=512

inference error: 2020-04-16 18:15:19.945517: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint Traceback (most recent call last): File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found. (0) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] (1) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

FancyFai avatar May 05 '20 03:05 FancyFai

Hello, I have encountered the same problem as you. Have you solved it

@Jupanlee Hello,我想请问一下,我inference出现的错误是什么原因,以下是我的训练命令和inference命令 train : python main.py -mode=train --num_classer=53 --training_file_pattern=tfrecord/train-000* --model_name=efficientdet-d0 --model_dir=model --ckpt=efficientdet-d0 --train_batch_size=32 --eval_batch_size=8 --eval_samples=1024 --num_examples_per_epoch=1619 --num_epochs=2 --hparams="use_bfloat16=false,num_classes=53,moving_average_decay=0" --use_tpu=False inference: python model_inspect.py --runmode=infer --model_name=efficientdet-d0 --ckpt_path=./model --max_boxes_to_draw=100 --min_score_thresh=0.2 --input_image=../automl/efficientdet/car01.jpeg --output_image_dir=tmp/ --num_classes=53 --input_image_size=512 inference error: 2020-04-16 18:15:19.945517: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint Traceback (most recent call last): File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found. (0) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] (1) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

并没有解决,你解决了吗?

gtgtgt1117 avatar May 07 '20 09:05 gtgtgt1117

You can try to set arg --hparams="moving_average_decay=0" in predict image command

Hello, I have encountered the same problem as you. Have you solved it

@Jupanlee Hello,我想请问一下,我inference出现的错误是什么原因,以下是我的训练命令和inference命令 train : python main.py -mode=train --num_classer=53 --training_file_pattern=tfrecord/train-000* --model_name=efficientdet-d0 --model_dir=model --ckpt=efficientdet-d0 --train_batch_size=32 --eval_batch_size=8 --eval_samples=1024 --num_examples_per_epoch=1619 --num_epochs=2 --hparams="use_bfloat16=false,num_classes=53,moving_average_decay=0" --use_tpu=False inference: python model_inspect.py --runmode=infer --model_name=efficientdet-d0 --ckpt_path=./model --max_boxes_to_draw=100 --min_score_thresh=0.2 --input_image=../automl/efficientdet/car01.jpeg --output_image_dir=tmp/ --num_classes=53 --input_image_size=512 inference error: 2020-04-16 18:15:19.945517: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint Traceback (most recent call last): File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/home/vcaadmin/miniconda3/envs/GEDet/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found. (0) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] (1) Not found: Key box_net/box-0-bn-3/beta/ExponentialMovingAverage not found in checkpoint [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

并没有解决,你解决了吗?

FancyFai avatar May 07 '20 09:05 FancyFai

https://github.com/google/automl/issues/348#issuecomment-623287987 This problem has been solved by the author

FancyFai avatar May 07 '20 09:05 FancyFai

#348 (comment) This problem has been solved by the author

代码已经更新了,当我保存模型的时候,会出现模型参数不在图当中.这是怎么回事儿?

gtgtgt1117 avatar May 07 '20 10:05 gtgtgt1117