# Path: pycoral/adapters/common.py
# def output_tensor(interpreter, i):
# def input_details(interpreter, key):
# def input_size(interpreter):
# def input_tensor(interpreter):
# def set_input(interpreter, data):
# def set_resized_input(interpreter, size, resize):
# 
# Path: pycoral/adapters/detect.py
# class BBox(collections.namedtuple('BBox', ['xmin', 'ymin', 'xmax', 'ymax'])):
#   def width(self):
#   def height(self):
#   def area(self):
#   def valid(self):
#   def scale(self, sx, sy):
#   def translate(self, dx, dy):
#   def map(self, f):
#   def intersect(a, b):
#   def union(a, b):
#   def iou(a, b):
# def get_objects(interpreter,
#                 score_threshold=-float('inf'),
#                 image_scale=(1.0, 1.0)):
#   def make(i):
# 
# Path: pycoral/utils/edgetpu.py
# _EDGETPU_SHARED_LIB = {
#   'Linux': 'libedgetpu.so.1',
#   'Darwin': 'libedgetpu.1.dylib',
#   'Windows': 'edgetpu.dll'
# }[platform.system()]
# def load_edgetpu_delegate(options=None):
# def make_interpreter(model_path_or_content, device=None, delegate=None):
# def _is_valid_ctypes_input(input_data):
# def _gst_buffer_map(buffer):
# def _check_input_size(input_size, expected_input_size):
# def run_inference(interpreter, input_data):
# class _GstMapInfo(ctypes.Structure):
# 
# Path: tests/test_utils.py
# _TEST_DATA_DIR = ''
#   _TEST_DATA_DIR = args.test_data_dir
# def get_test_tmpdir():
# def test_data_path(path, *paths):
# def test_image(path, *paths):
# def temporary_file(suffix=None):
# def generate_random_input(seed, n):
# def prepare_images(image_list, directory, shape):
# def area(box):
# def iou(box_a, box_b):
# def prepare_data_set_from_directory(path, test_ratio, fixed_order):
# def coral_test_main():


from PIL import Image
from pycoral.adapters import common
from pycoral.adapters import detect
from pycoral.utils import edgetpu
from tests import test_utils
import unittest
    self.assertEqual(BBox(1, 1, 10, 20).translate(10, 20), BBox(11, 21, 20, 40))

  def test_map(self):
    self.assertEqual(BBox(1.1, 2.1, 3.1, 4.1).map(int), BBox(1, 2, 3, 4))
    self.assertEqual(BBox(1.9, 2.9, 3.9, 4.9).map(int), BBox(1, 2, 3, 4))

  def test_intersect_valid(self):
    a = BBox(0, 0, 200, 200)
    b = BBox(100, 100, 300, 300)

    self.assertAlmostEqual(BBox.iou(a, b), 0.14286, delta=0.0001)
    self.assertEqual(BBox.intersect(a, b), BBox(100, 100, 200, 200))

  def test_intersect_invalid(self):
    a = BBox(0, 0, 10, 20)
    b = BBox(20, 30, 25, 35)
    self.assertAlmostEqual(BBox.iou(a, b), 0.0)
    self.assertEqual(BBox.intersect(a, b), BBox(20, 30, 10, 20))

  def test_union(self):
    self.assertEqual(
        BBox.union(BBox(0, 0, 10, 20), BBox(50, 50, 60, 70)),
        BBox(0, 0, 60, 70))


class DetectTest(unittest.TestCase):

  @classmethod
  def setUpClass(cls):
    super(DetectTest, cls).setUpClass()

# Path: pycoral/adapters/common.py
# def output_tensor(interpreter, i):
# def input_details(interpreter, key):
# def input_size(interpreter):
# def input_tensor(interpreter):
# def set_input(interpreter, data):
# def set_resized_input(interpreter, size, resize):
# 
# Path: pycoral/adapters/detect.py
# class BBox(collections.namedtuple('BBox', ['xmin', 'ymin', 'xmax', 'ymax'])):
#   def width(self):
#   def height(self):
#   def area(self):
#   def valid(self):
#   def scale(self, sx, sy):
#   def translate(self, dx, dy):
#   def map(self, f):
#   def intersect(a, b):
#   def union(a, b):
#   def iou(a, b):
# def get_objects(interpreter,
#                 score_threshold=-float('inf'),
#                 image_scale=(1.0, 1.0)):
#   def make(i):
# 
# Path: pycoral/utils/edgetpu.py
# _EDGETPU_SHARED_LIB = {
#   'Linux': 'libedgetpu.so.1',
#   'Darwin': 'libedgetpu.1.dylib',
#   'Windows': 'edgetpu.dll'
# }[platform.system()]
# def load_edgetpu_delegate(options=None):
# def make_interpreter(model_path_or_content, device=None, delegate=None):
# def _is_valid_ctypes_input(input_data):
# def _gst_buffer_map(buffer):
# def _check_input_size(input_size, expected_input_size):
# def run_inference(interpreter, input_data):
# class _GstMapInfo(ctypes.Structure):
# 
# Path: tests/test_utils.py
# _TEST_DATA_DIR = ''
#   _TEST_DATA_DIR = args.test_data_dir
# def get_test_tmpdir():
# def test_data_path(path, *paths):
# def test_image(path, *paths):
# def temporary_file(suffix=None):
# def generate_random_input(seed, n):
# def prepare_images(image_list, directory, shape):
# def area(box):
# def iou(box_a, box_b):
# def prepare_data_set_from_directory(path, test_ratio, fixed_order):
# def coral_test_main():


# Path: tests/detect_test.py
from PIL import Image
from pycoral.adapters import common
from pycoral.adapters import detect
from pycoral.utils import edgetpu
from tests import test_utils
import unittest

    self.assertEqual(BBox(1, 1, 10, 20).translate(10, 20), BBox(11, 21, 20, 40))

  def test_map(self):
    self.assertEqual(BBox(1.1, 2.1, 3.1, 4.1).map(int), BBox(1, 2, 3, 4))
    self.assertEqual(BBox(1.9, 2.9, 3.9, 4.9).map(int), BBox(1, 2, 3, 4))

  def test_intersect_valid(self):
    a = BBox(0, 0, 200, 200)
    b = BBox(100, 100, 300, 300)

    self.assertAlmostEqual(BBox.iou(a, b), 0.14286, delta=0.0001)
    self.assertEqual(BBox.intersect(a, b), BBox(100, 100, 200, 200))

  def test_intersect_invalid(self):
    a = BBox(0, 0, 10, 20)
    b = BBox(20, 30, 25, 35)
    self.assertAlmostEqual(BBox.iou(a, b), 0.0)
    self.assertEqual(BBox.intersect(a, b), BBox(20, 30, 10, 20))

  def test_union(self):
    self.assertEqual(
        BBox.union(BBox(0, 0, 10, 20), BBox(50, 50, 60, 70)),
        BBox(0, 0, 60, 70))


class DetectTest(unittest.TestCase):

  @classmethod
  def setUpClass(cls):
    super(DetectTest, cls).setUpClass()

    cls.delegate = edgetpu.load_edgetpu_delegate()