# Path: annotate/annotate_attributes.py
# ATTRIBUTE_GROUPS = [
#     ATTRIBUTE_GROUP_ROAD_TYPE,
#     ATTRIBUTE_GROUP_INTERSECTION,
#     ATTRIBUTE_GROUP_DIRECTION,
#     ATTRIBUTE_GROUP_LANE_COUNT,
#     ATTRIBUTE_GROUP_CURVE,
#     ATTRIBUTE_GROUP_SPACE_FRONT,
#     ATTRIBUTE_GROUP_SPACE_LEFT,
#     ATTRIBUTE_GROUP_SPACE_RIGHT,
#     ATTRIBUTE_GROUP_OFFROAD
# ]
# 
# Path: lib/util.py
# def to_numpy(var):
#     #if ia.is_numpy_array(var):
#     if isinstance(var, (np.ndarray, np.generic)):
#         return var
#     else:
#         return var.data.cpu().numpy()
# 
# Path: lib/util.py
# def template_match(needle, haystack):
# def compress_to_jpg(img):
# def compress_img(img, method):
# def decompress_img(img_compressed):
# def draw_image(img, other_img, x, y, copy=True, raise_if_oob=False):
# def draw_point(img, y, x, size=5, color=[255, 0, 0], alpha=1.0, copy=True):
# def draw_line(img, y1, x1, y2, x2, color=[0, 255, 0], alpha=1.0, thickness=1, clip_result=True, copy=True):
# def draw_direction_circle(img, y, x, r_inner, r_outer, angle_start, angle_end, color_border=[0, 255, 0], color_fill=[0, 200, 0], alpha=1.0):
# def draw_text(img, y, x, text, color=[0, 255, 0], size=25):
# def to_variable(inputs, volatile=False, requires_grad=True):
# def to_variables(inputs, volatile=False, requires_grad=True):
# def to_cuda(inputs, gpu=Config.GPU):
# def to_numpy(var):
# def draw_heatmap_overlay(img, heatmap, alpha=0.5):
# def create_2d_gaussian_old(size, fwhm=3, center=None):
# def create_2d_gaussian(size, sigma):
# FONT_CACHE = dict()


import sys
import os
import train
import imgaug as ia
import numpy as np
from annotate.annotate_attributes import ATTRIBUTE_GROUPS
from lib.util import to_numpy
from lib import util
from __future__ import division, print_function

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))



try:
    xrange
except NameError:
    xrange = range

def generate_debug_image(images, images_prev, \
    outputs_ae_gt, outputs_grids_gt, outputs_atts_gt, \
    outputs_multiactions_gt, outputs_flow_gt, outputs_canny_gt, \
    outputs_flipped_gt, \
    outputs_ae_pred, outputs_grids_pred, outputs_atts_pred, \
    outputs_multiactions_pred, outputs_flow_pred, outputs_canny_pred, \
    outputs_flipped_pred, \
    grids_annotated, atts_annotated):
    image = to_numpy(images)[0]
    grids_annotated = grids_annotated[0]
    atts_annotated = atts_annotated[0]


# Path: annotate/annotate_attributes.py
# ATTRIBUTE_GROUPS = [
#     ATTRIBUTE_GROUP_ROAD_TYPE,
#     ATTRIBUTE_GROUP_INTERSECTION,
#     ATTRIBUTE_GROUP_DIRECTION,
#     ATTRIBUTE_GROUP_LANE_COUNT,
#     ATTRIBUTE_GROUP_CURVE,
#     ATTRIBUTE_GROUP_SPACE_FRONT,
#     ATTRIBUTE_GROUP_SPACE_LEFT,
#     ATTRIBUTE_GROUP_SPACE_RIGHT,
#     ATTRIBUTE_GROUP_OFFROAD
# ]
# 
# Path: lib/util.py
# def to_numpy(var):
#     #if ia.is_numpy_array(var):
#     if isinstance(var, (np.ndarray, np.generic)):
#         return var
#     else:
#         return var.data.cpu().numpy()
# 
# Path: lib/util.py
# def template_match(needle, haystack):
# def compress_to_jpg(img):
# def compress_img(img, method):
# def decompress_img(img_compressed):
# def draw_image(img, other_img, x, y, copy=True, raise_if_oob=False):
# def draw_point(img, y, x, size=5, color=[255, 0, 0], alpha=1.0, copy=True):
# def draw_line(img, y1, x1, y2, x2, color=[0, 255, 0], alpha=1.0, thickness=1, clip_result=True, copy=True):
# def draw_direction_circle(img, y, x, r_inner, r_outer, angle_start, angle_end, color_border=[0, 255, 0], color_fill=[0, 200, 0], alpha=1.0):
# def draw_text(img, y, x, text, color=[0, 255, 0], size=25):
# def to_variable(inputs, volatile=False, requires_grad=True):
# def to_variables(inputs, volatile=False, requires_grad=True):
# def to_cuda(inputs, gpu=Config.GPU):
# def to_numpy(var):
# def draw_heatmap_overlay(img, heatmap, alpha=0.5):
# def create_2d_gaussian_old(size, fwhm=3, center=None):
# def create_2d_gaussian(size, sigma):
# FONT_CACHE = dict()


# Path: train_semisupervised/visualization.py
import sys
import os
import train
import imgaug as ia
import numpy as np
from annotate.annotate_attributes import ATTRIBUTE_GROUPS
from lib.util import to_numpy
from lib import util

from __future__ import division, print_function

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))



try:
    xrange
except NameError:
    xrange = range

def generate_debug_image(images, images_prev, \
    outputs_ae_gt, outputs_grids_gt, outputs_atts_gt, \
    outputs_multiactions_gt, outputs_flow_gt, outputs_canny_gt, \
    outputs_flipped_gt, \
    outputs_ae_pred, outputs_grids_pred, outputs_atts_pred, \
    outputs_multiactions_pred, outputs_flow_pred, outputs_canny_pred, \
    outputs_flipped_pred, \
    grids_annotated, atts_annotated):
    image = to_numpy(images)[0]
    grids_annotated = grids_annotated[0]
    atts_annotated = atts_annotated[0]


    ae_gt = to_numpy(outputs_ae_gt)[0]