automl icon indicating copy to clipboard operation
automl copied to clipboard

Inference with pretrained checkpoint

Open Phelan164 opened this issue 4 years ago • 2 comments

I tried:

  • download pretrain checkpoint D0 and D7
  • save model: python model_inspect.py --runmode=saved_model --model_name=efficientdet-d0 --ckpt_path=efficientdet-d0 --saved_model_dir=/tmp/saved_model_0
  • inference with image: python model_inspect.py --runmode=saved_model_infer --saved_model_dir=/tmp/saved_model_0 --model_name=efficientdet-d0 --input_image=/tmp/train_all/00053190460d56c53cc3e57321387478.jpg --output_image_dir=out

Error:

Traceback (most recent call last):
  File "model_inspect.py", line 520, in <module>
    app.run(main)
  File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "model_inspect.py", line 513, in main
    trace_filename=FLAGS.trace_filename)
  File "model_inspect.py", line 468, in run_model
    kwargs['output_image_dir'], **config_dict)
  File "model_inspect.py", line 183, in saved_model_inference
    detections_bs = driver.serve_images(raw_images)
  File "/root/automl/efficientdet/inference.py", line 530, in serve_images
    feed_dict={self.signitures['image_arrays']: image_arrays})
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 968, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1167, in _run
    (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 2430, 1994) for Tensor 'image_arrays:0', which has shape '(None, None, None, None)'

Phelan164 avatar Feb 21 '21 04:02 Phelan164

commit id?

kartik4949 avatar May 13 '21 08:05 kartik4949

If you haven't solved already; The problem is, you are feeding the model with 1 channel image, while model is expecting 3 channel input.

oguzhannfsgl avatar Jul 07 '21 17:07 oguzhannfsgl