# Path: selfsup/multi/methods/base.py
# class Method:
#     def __init__(self, name, batch_size):
#         self.name = name
#         self.batch_size = batch_size
# 
#     def input_size(self):
#         return 0
# 
#     def batch_loader(self):
#         raise NotImplemented("Abstract base class")
# 
#     def build_network(network, y, phase_test):
#         raise NotImplemented("Abstract base class")
# 
#     @property
#     def basenet_settings():
#         return {}
# 
#     def make_path(self, name, ext, iteration):
#         return f'img/{self.name}_{name}_{iteration}.png'


import selfsup
import tensorflow as tf
import os
import functools
from .base import Method
from autocolorize.tensorflow.sparse_extractor import sparse_extractor
from autocolorize.extraction import calc_rgb_from_hue_chroma
from collections import OrderedDict
    @property
    def basenet_settings(self):
        return {'convolutional': True}

    def batch(self):
        x, extra = self._loader.batch()

        input_size = x.get_shape().as_list()[1]

        edge_buffer = int(self.edge_buffer * self._loader.scale_factor)
        self.centroids = tf.to_float(tf.random_uniform(
                shape=[self._loader.batch_size, self.locations, 2],
                minval=edge_buffer,
                maxval=input_size - edge_buffer,
                name='centroids',
                dtype=tf.int32))

        assert 'saliency' in extra
        self.saliency = extra['saliency']
        return x, extra

    def build_network(self, basenet_info, extra, phase_test, global_step):
        info = selfsup.info.create(scale_summary=True)

        hyper = []

        dropout = functools.partial(selfsup.ops.dropout, phase_test=phase_test, info=info)

        with tf.name_scope('hypercolumn'):
            for name, scale in self.basenet.hypercolumn_layers:

# Path: selfsup/multi/methods/base.py
# class Method:
#     def __init__(self, name, batch_size):
#         self.name = name
#         self.batch_size = batch_size
# 
#     def input_size(self):
#         return 0
# 
#     def batch_loader(self):
#         raise NotImplemented("Abstract base class")
# 
#     def build_network(network, y, phase_test):
#         raise NotImplemented("Abstract base class")
# 
#     @property
#     def basenet_settings():
#         return {}
# 
#     def make_path(self, name, ext, iteration):
#         return f'img/{self.name}_{name}_{iteration}.png'


# Path: selfsup/multi/methods/video_saliency_hypercolumn.py
import selfsup
import tensorflow as tf
import os
import functools
from .base import Method
from autocolorize.tensorflow.sparse_extractor import sparse_extractor
from autocolorize.extraction import calc_rgb_from_hue_chroma
from collections import OrderedDict

    @property
    def basenet_settings(self):
        return {'convolutional': True}

    def batch(self):
        x, extra = self._loader.batch()

        input_size = x.get_shape().as_list()[1]

        edge_buffer = int(self.edge_buffer * self._loader.scale_factor)
        self.centroids = tf.to_float(tf.random_uniform(
                shape=[self._loader.batch_size, self.locations, 2],
                minval=edge_buffer,
                maxval=input_size - edge_buffer,
                name='centroids',
                dtype=tf.int32))

        assert 'saliency' in extra
        self.saliency = extra['saliency']
        return x, extra

    def build_network(self, basenet_info, extra, phase_test, global_step):
        info = selfsup.info.create(scale_summary=True)

        hyper = []

        dropout = functools.partial(selfsup.ops.dropout, phase_test=phase_test, info=info)

        with tf.name_scope('hypercolumn'):
            for name, scale in self.basenet.hypercolumn_layers:

                sparse_layer = sparse_extractor(self.centroids,