# Path: ssd/ssdmodel.py
# class SSDModel:
#     def __init__(self, feature_extractor, model_name, weight_decay, is_training=True):
#     def get_model(self, inputs):
#     def get_anchors_all_layers(self, dtype=np.float32):
#     def get_all_anchors(self, minmaxformat=False):
#     def match_achors(self, gt_labels, gt_bboxes, matching_threshold=0.5):
#     def decode_bboxes_layer(self, feat_localizations, anchors):
#     def decode_bboxes_all_layers(self, localizations):
#     def decode_bboxes_all_layers_tf(self, feat_localizations):
#     def bboxes_encode(self, labels, bboxes, dtype=tf.float32, scope='ssd_bboxes_encode'):
#     def _convert2layers(self, gclasses, glocalisations, gscores):
# def get_losses(logits, localisations, gclasses, glocalisations, gscores,
#                match_threshold=0, negative_ratio=2.5, alpha=1., scope=None):
# def detected_bboxes(predictions, localisations, num_classes,
#                     select_threshold=0.01, nms_threshold=0.45,
#                     clipping_bbox=None, top_k=400, keep_top_k=200):


import os
import time
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import timeline
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import saver as tf_saver
from collections import namedtuple
from ssd import ssdmodel
        self.momentum = 0.9
        self.rmsprop_decay = 0.9
        self.rmsprop_momentum = 0.9
        self.label_smoothing = 0

        self.g_prepare = data_preparer
        self.g_post = data_postprocessor
        self.g_ssd = ssd_model

        self.fine_tune_fe = params.fine_tune_fe
        self.train_dir = params.train_dir
        self.checkpoint_path = params.checkpoint_path
        self.ignore_missing_vars = params.ignore_missing_vars
        self.learning_rate = params.learning_rate
        self.learning_rate_decay_type = params.learning_rate_decay_type
        self.learning_rate_decay_factor = params.learning_rate_decay_factor
        self.num_epochs_per_decay = params.num_epochs_per_decay
        self.end_learning_rate = params.end_learning_rate
        self.max_number_of_steps = params.max_number_of_steps
        self.optimizer = params.optimizer
        self.weight_decay = params.weight_decay
        self.batch_size = params.batch_size
        self.log_every_n_steps = params.log_every_n_steps
        self.save_interval_secs = params.save_interval_secs
        self.save_summaries_secs = params.save_summaries_secs

        if self.fine_tune_fe is False:
            self.checkpoint_exclude_scopes = '{},{}'.format(self.g_ssd.params.model_name, 'bbox_layers')
            self.trainable_scopes = self.checkpoint_exclude_scopes
        elif self.fine_tune_fe is True:

# Path: ssd/ssdmodel.py
# class SSDModel:
#     def __init__(self, feature_extractor, model_name, weight_decay, is_training=True):
#     def get_model(self, inputs):
#     def get_anchors_all_layers(self, dtype=np.float32):
#     def get_all_anchors(self, minmaxformat=False):
#     def match_achors(self, gt_labels, gt_bboxes, matching_threshold=0.5):
#     def decode_bboxes_layer(self, feat_localizations, anchors):
#     def decode_bboxes_all_layers(self, localizations):
#     def decode_bboxes_all_layers_tf(self, feat_localizations):
#     def bboxes_encode(self, labels, bboxes, dtype=tf.float32, scope='ssd_bboxes_encode'):
#     def _convert2layers(self, gclasses, glocalisations, gscores):
# def get_losses(logits, localisations, gclasses, glocalisations, gscores,
#                match_threshold=0, negative_ratio=2.5, alpha=1., scope=None):
# def detected_bboxes(predictions, localisations, num_classes,
#                     select_threshold=0.01, nms_threshold=0.45,
#                     clipping_bbox=None, top_k=400, keep_top_k=200):


# Path: trainer/trainer.py
import os
import time
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import timeline
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import saver as tf_saver
from collections import namedtuple
from ssd import ssdmodel

        self.momentum = 0.9
        self.rmsprop_decay = 0.9
        self.rmsprop_momentum = 0.9
        self.label_smoothing = 0

        self.g_prepare = data_preparer
        self.g_post = data_postprocessor
        self.g_ssd = ssd_model

        self.fine_tune_fe = params.fine_tune_fe
        self.train_dir = params.train_dir
        self.checkpoint_path = params.checkpoint_path
        self.ignore_missing_vars = params.ignore_missing_vars
        self.learning_rate = params.learning_rate
        self.learning_rate_decay_type = params.learning_rate_decay_type
        self.learning_rate_decay_factor = params.learning_rate_decay_factor
        self.num_epochs_per_decay = params.num_epochs_per_decay
        self.end_learning_rate = params.end_learning_rate
        self.max_number_of_steps = params.max_number_of_steps
        self.optimizer = params.optimizer
        self.weight_decay = params.weight_decay
        self.batch_size = params.batch_size
        self.log_every_n_steps = params.log_every_n_steps
        self.save_interval_secs = params.save_interval_secs
        self.save_summaries_secs = params.save_summaries_secs

        if self.fine_tune_fe is False:
            self.checkpoint_exclude_scopes = '{},{}'.format(self.g_ssd.params.model_name, 'bbox_layers')
            self.trainable_scopes = self.checkpoint_exclude_scopes
        elif self.fine_tune_fe is True:

            self.checkpoint_exclude_scopes = None