# Path: dataset/pose_dataset.py
# class Batch(Enum):
#     inputs = 0
#     part_score_targets = 1
#     part_score_weights = 2
#     locref_targets = 3
#     locref_mask = 4
#     pairwise_targets = 5
#     pairwise_mask = 6
#     data_item = 7
# 
# Path: nnet/losses.py
# def huber_loss(labels, predictions, weight=1.0, k=1.0, scope=None):


import re
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.slim.nets import resnet_v1
from dataset.pose_dataset import Batch
from nnet import losses
                out['part_pred_interm'] = prediction_layer(cfg, block_interm_out,
                                                           'intermediate_supervision',
                                                           cfg.num_joints)

        return out

    def get_net(self, inputs):
        net, end_points = self.extract_features(inputs)
        return self.prediction_layers(net, end_points)

    def test(self, inputs):
        heads = self.get_net(inputs)
        return self.add_test_layers(heads)

    def add_test_layers(self, heads):
        prob = tf.sigmoid(heads['part_pred'])
        outputs = {'part_prob': prob}
        if self.cfg.location_refinement:
            outputs['locref'] = heads['locref']
        if self.cfg.pairwise_predict:
            outputs['pairwise_pred'] = heads['pairwise_pred']
        return outputs

    def part_detection_loss(self, heads, batch, locref, pairwise, intermediate):
        cfg = self.cfg

        weigh_part_predictions = cfg.weigh_part_predictions
        part_score_weights = batch[Batch.part_score_weights] if weigh_part_predictions else 1.0

        def add_part_loss(pred_layer):

# Path: dataset/pose_dataset.py
# class Batch(Enum):
#     inputs = 0
#     part_score_targets = 1
#     part_score_weights = 2
#     locref_targets = 3
#     locref_mask = 4
#     pairwise_targets = 5
#     pairwise_mask = 6
#     data_item = 7
# 
# Path: nnet/losses.py
# def huber_loss(labels, predictions, weight=1.0, k=1.0, scope=None):


# Path: nnet/pose_net.py
import re
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.slim.nets import resnet_v1
from dataset.pose_dataset import Batch
from nnet import losses

                out['part_pred_interm'] = prediction_layer(cfg, block_interm_out,
                                                           'intermediate_supervision',
                                                           cfg.num_joints)

        return out

    def get_net(self, inputs):
        net, end_points = self.extract_features(inputs)
        return self.prediction_layers(net, end_points)

    def test(self, inputs):
        heads = self.get_net(inputs)
        return self.add_test_layers(heads)

    def add_test_layers(self, heads):
        prob = tf.sigmoid(heads['part_pred'])
        outputs = {'part_prob': prob}
        if self.cfg.location_refinement:
            outputs['locref'] = heads['locref']
        if self.cfg.pairwise_predict:
            outputs['pairwise_pred'] = heads['pairwise_pred']
        return outputs

    def part_detection_loss(self, heads, batch, locref, pairwise, intermediate):
        cfg = self.cfg

        weigh_part_predictions = cfg.weigh_part_predictions
        part_score_weights = batch[Batch.part_score_weights] if weigh_part_predictions else 1.0

        def add_part_loss(pred_layer):

            return tf.losses.sigmoid_cross_entropy(batch[Batch.part_score_targets],