:mod:`blueoil.networks.base` ============================ .. py:module:: blueoil.networks.base Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: blueoil.networks.base.BaseNetwork .. py:class:: BaseNetwork(is_debug=False, optimizer_class=tf.compat.v1.train.GradientDescentOptimizer, optimizer_kwargs=None, learning_rate_func=None, learning_rate_kwargs=None, classes=(), image_size=(), batch_size=64, data_format='NHWC') Bases: :class:`object` Base network. This base network is for every task, such as classification, object detection and segmentation. Every sub task's base network class should extend this class. :param is_debug: Set True to use debug mode. It will summary some histograms, use small dataset and step size. :type is_debug: boolean :param optimizer_class: Optimizer using for training. :type optimizer_class: class :param optimizer_kwargs: For init optimizer. :type optimizer_kwargs: dict :param learning_rate_func: Use for changing learning rate. Such as learning rate decay, `tf.train.piecewise_constant`. :type learning_rate_func: callable :param learning_rate_kwargs: For learning rate function. For example of `tf.train.piecewise_constant`, `{"values": [5e-5, 1e-5, 5e-6, 1e-6, 5e-7], "boundaries": [20000, 40000, 60000, 80000]}`. :type learning_rate_kwargs: dict :param classes: Classes names list. :type classes: list | tuple :param image_size: Image size. :type image_size: list | tuple :param batch_size: Batch size. :type batch_size: list | tuple .. method:: base(self, images, is_training, *args, **kwargs) :abstractmethod: Base function contains inference. :param images: Input images. :param is_training: A flag for if is training. :returns: Inference result. :rtype: tf.Tensor .. method:: placeholders(self) :abstractmethod: Placeholders. Return placeholders. :returns: Placeholders. :rtype: tf.compat.v1.placeholder .. method:: metrics(self, output, labels) :abstractmethod: Metrics. :param output: tensor from inference. :param labels: labels tensor. .. method:: summary(self, output, labels=None) Summary. :param output: tensor from inference. :param labels: labels tensor. .. method:: inference(self, images, is_training) :abstractmethod: Inference. :param images: images tensor. shape is (batch_num, height, width, channel) .. method:: loss(self, output, labels) :abstractmethod: Loss. :param output: tensor from inference. :param labels: labels tensor. .. method:: optimizer(self) .. method:: train(self, loss, optimizer, var_list=[]) Train. :param loss: loss function of this network.