tensorflow / models

Models and examples built with TensorFlow
Other
77.16k stars 45.75k forks source link

[DeepLab] Inference with pre-trained model on test images #7215

Open paviddavid opened 5 years ago

paviddavid commented 5 years ago

System information

I do not fully understand how to infer a pre-trained model (e.g. trained on Cityscapes data) on some road scene images.

Command I use:

python3.5 eval.py \ 
--logtostderr \
 --eval_split="val" \
 --model_variant="xception_65" \
--atrous_rates=6 \
 --atrous_rates=12  \
 --atrous_rates=18 \
 --output_stride=16 \
 --decoder_output_stride=4 \
 --eval_crop_size="1025,2049" \
 --dataset="cityscapes" \
 --checkpoint_dir=/home/user/tensorflow/models/research/deeplab/datasets/deeplabv3_cityscapes_train/ \
 --eval_logdir=/home/user/tensorflow/models/research/deeplab/OUTPUT \
--dataset_dir=/home/user/tensorflow/models/research/deeplab/datasets/test-data.tfrecord

the tfrecord file contains only image height, width, channels, filename, encoded image, image format.

1) Is the tfrecord data correct? I do not load any semantic images because I only want to run the inference, the semantic segmentation of some input images which I want to save.

2) Is the way how the eval.py is called correct?

Error code:


Traceback (most recent call last):
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flag.py", line 166, in _parse
    return self.parser.parse(argument)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_argument_parser.py", line 152, in parse
    val = self.convert(argument)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_argument_parser.py", line 265, in convert
    return int(argument, base)
ValueError: invalid literal for int() with base 10: '1025,2049'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "eval.py", line 177, in <module>
    tf.app.run()
  File "/home/user/.local/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 119, in run
    argv = flags.FLAGS(_sys.argv if argv is None else argv, known_only=True)
  File "/home/user/.local/lib/python3.5/site-packages/tensorflow/python/platform/flags.py", line 112, in __call__
    return self.__dict__['__wrapped'].__call__(*args, **kwargs)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flagvalues.py", line 625, in __call__
    unknown_flags, unparsed_args = self._parse_args(args, known_only)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flagvalues.py", line 761, in _parse_args
    flag.parse(value)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flag.py", line 363, in parse
    new_values = self._parse(arguments)
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flag.py", line 377, in _parse
    return [super(MultiFlag, self)._parse(item) for item in arguments]
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flag.py", line 377, in <listcomp>
    return [super(MultiFlag, self)._parse(item) for item in arguments]
  File "/home/user/.local/lib/python3.5/site-packages/absl/flags/_flag.py", line 169, in _parse
    'flag --%s=%s: %s' % (self.name, argument, e))
absl.flags._exceptions.IllegalFlagValueError: flag --eval_crop_size=1025,2049: invalid literal for int() with base 10: '1025,2049'
rajanieprabha commented 5 years ago

As per my understanding, eval.py is for evaluation. You need ground truth for that. For inference, you can use deeplab_demo.ipynb Also. for the above error, you should check this https://github.com/tensorflow/models/commit/85b6489340c5b0a2a321388245d7d7de6afbcfe1#diff-52334c5559a6b56b843a54278cb60cf4

Hope this helps.

zheyuanWang commented 5 years ago

Can I use python 3.6.8 instead of python 3.5 here?

DancingJane commented 4 years ago

I have the same problem. did you solve it?

ibaiGorordo commented 4 years ago

First of all, sorry for commenting in an old issue.

I have created a repository to visualize the inference on Deeplab models trained on the Cityscapes dataset. Check the Deeplab Cityscapes inference repository.

Ibai