# 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
        gray = tf.tile(gray_single, [1, 1, 1, 3])

        if self._label_scale > 1.0:
            w = input_size // int(self._label_scale)
            x4 = tf.image.resize_bilinear(x, (w, w))
        else:
            x4 = x

        hsv = tf.image.rgb_to_hsv(x4)

        self.hue = tf.expand_dims(hsv[..., 0], -1)
        self.chr = tf.reduce_max(x4, 3, keep_dims=True) - tf.reduce_min(x4, 3, keep_dims=True)

        #self.chr = tf.reduce_mean(x, 3, keep_dims=True)

        self.huechr = tf.concat([self.hue, self.chr], 3)

        return gray, dict(grayscale=gray_single, hsv=hsv), #, imgshape, imgname

    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'):
            layers = self.basenet.hypercolumn_layers
            if self._version == 2:
                layers = layers[4:]

# 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/colorize_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

        gray = tf.tile(gray_single, [1, 1, 1, 3])

        if self._label_scale > 1.0:
            w = input_size // int(self._label_scale)
            x4 = tf.image.resize_bilinear(x, (w, w))
        else:
            x4 = x

        hsv = tf.image.rgb_to_hsv(x4)

        self.hue = tf.expand_dims(hsv[..., 0], -1)
        self.chr = tf.reduce_max(x4, 3, keep_dims=True) - tf.reduce_min(x4, 3, keep_dims=True)

        #self.chr = tf.reduce_mean(x, 3, keep_dims=True)

        self.huechr = tf.concat([self.hue, self.chr], 3)

        return gray, dict(grayscale=gray_single, hsv=hsv), #, imgshape, imgname

    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'):
            layers = self.basenet.hypercolumn_layers
            if self._version == 2:
                layers = layers[4:]

            for name, scale in layers: