Viktor Nikolaev
Viktor Nikolaev

Reputation: 41

Training ssd inception_v3 using pretrained model from slim

I want to train ssd inception_v3 model using object detection API with pretrained model from SLIM (link) I try to train object detection ssd inception v3 model using config:

model {
  ssd {
    num_classes: 1
    image_resizer {
      fixed_shape_resizer {
        height: 240
        width: 320
      }
    }
    feature_extractor {
      type: "ssd_inception_v3"
      depth_multiplier: 1.0
      min_depth: 16
      conv_hyperparams {
        regularizer {
          l2_regularizer {
            weight: 3.99999989895e-05
          }
        }
        initializer {
          truncated_normal_initializer {
            mean: 0.0
            stddev: 0.0299999993294
          }
        }
        activation: RELU_6
        batch_norm {
          decay: 0.999700009823
          center: true
          scale: true
          epsilon: 0.0010000000475
          train: true
        }
      }
      override_base_feature_extractor_hyperparams: true
    }
...

I stopped procces after creating files model.ckpt-0.*, loaded and printed all tensors' names.

After that I loaded pretrained model from https://github.com/tensorflow/models/tree/master/research/slim using

reader = pywrap_tensorflow.NewCheckpointReader(os.path.join(folder, 'model.ckpt'))
var_to_shape_map = reader.get_variable_to_shape_map()

When I compared output I didn't see a lot layers for ssd incpetion v3 model. For example:

InceptionV3/AuxLogits/Conv2d_2a_5x5/weights InceptionV3/Mixed_7c/Branch_3/Conv2d_0b_1x1/weight

In model from ssd_inception_v3 I saw mixed layers before 5c.

What are the differences of Feature Extractor in SSD_inception and SLIM models? In general, is it possible to load weights from SLIM for the classifier in the Object detection API for detection.

Upvotes: 2

Views: 1167

Answers (1)

netanel-sam
netanel-sam

Reputation: 1912

You can see what happens in ssd_inception_v3_feature_extractor. It uses the outputs of 'Mixed_5d', 'Mixed_6e', 'Mixed_7c' of InceptionV3 from inception_v3.inception_v3_base (Note the _base) and creating 3 additional feature maps with 512, 256, 128 number of channels (this happens in feature_map_generators.multi_resolution_feature_maps by feature_map_layout). Loading the weights of the classifier for the detection model can be done by configuration:

train_config{
    ...
    fine_tune_checkpoint: <path_to_inception_checkpoint>
    fine_tune_checkpoint_type: "classification"
}

Of course that the checkpoint has to match the model you're using, e.g. ssd_inception_v3.

Upvotes: 1

Related Questions