models icon indicating copy to clipboard operation
models copied to clipboard

Some question about the model operation of TFOD models

Open PythonImageDeveloper opened this issue 7 years ago • 3 comments

I'm working on SSD models, and I trained on my own dataset that have varity size of images, my question are: Q1-In the training mode, when I converted the images to tfrecord file, I didn't resize them to any fix size such as 300, So the network train multi-scale mode or the API automatically convert the images to fix size of network? Q2-In the inference mode, the network works with any input size, why? Shouldn't be only works with input size of network such as 300*300, if the ssd model work with any input size, So in the config file of ssd model why use fix input size?

    image_resizer {
      fixed_shape_resizer {
        height: 300
        width: 300
      }
    }

Q3-If I change the image_resizer to 600*600 and assume I work with ssd_inception_v2_coco : If I train the checkpoint of this model, because I change the input_size from 300 to 600, the model trains from scratch or progress in resume mode?

PythonImageDeveloper avatar May 30 '19 07:05 PythonImageDeveloper

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

tensorflowbutler avatar May 31 '19 12:05 tensorflowbutler

In TFOD API, there is a preprocessing step that cover operations like resizing, augmentation etc. For the SSD model, it still needs all input images to be fixed shape and of the same size, but because of this preprocessing step, input images can have various sizes. So answering your question, Q1. The API automatically convert the images during the preprocessing step. After input is read from tfrecord, for more specific info, please see https://github.com/tensorflow/models/blob/080347bc9056fdb8f0a2236ccdb5bfef1cdf0cca/research/object_detection/inputs.py#L50 for all preprocessing operations.

Q2. During inference, there is a preprocessing step in feature extractor and image_resizer_fn is part of the step therefore the model can still work with any input size images. The image_resizer in the config file is exactly specified for the image_resizer_fn.

Q3. If you retrain from a checkpoint, the model will resume its weights from the checkpoint. The image_resizer does not contain any learnable parameters . So what changed when image_resizer changed from 300*300 to 600*600? The input images contain more pixels so the final feature maps are also bigger, it may contain more information for the box predictor to make better predictions, also the model will make more predictions so it effectively makes the model slower (You see there is a speed accuracy tradeoff). (Some of these predictions will be filtered out.)

danyfang avatar Jun 05 '19 12:06 danyfang

Hi There, We are checking to see if you still need help on this, as this seems to be an old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.

tensorflowbutler avatar Mar 18 '20 21:03 tensorflowbutler