# Path: automl_video_ondevice/shot_classification/config.py
# class ShotClassificationConfig:
#   device: str = ""
# 
#   # Number of highest scoring labels to output.
#   # If max_results is -1 then all labels are used.
#   top_k: int = 5
# 
#   # Only labels with scores > threshold are output.
#   score_threshold: float = 0.0
# 
#   # Outputs duplicate results for several frames.
#   # Predictions from the classification model is done every 25 frames. If
#   # duplicate_results is true then each 25 frame input will return the previous
#   # output, otherwise the output array will be have a single None value.
#   duplicate_results: bool = False
# 
#   # Waits this number of frames before running inference.
#   # This is ignored by the LSTM model.
#   inference_rate: int = 25
# 
#   # Sliding window size.
#   # This is ignored by the LSTM model.
#   sliding_window_size: int = 64
# 
# Path: automl_video_ondevice/types.py
# class ShotClassificationAnnotation:
#   timestamp: float
#   class_name: str
#   confidence_score: float
# 
# Path: automl_video_ondevice/types.py
# class Size:
#   width: int
#   height: int


from typing import List
from typing import Union
from automl_video_ondevice.shot_classification.config import ShotClassificationConfig
from automl_video_ondevice.types import ShotClassificationAnnotation
from automl_video_ondevice.types import Size
import numpy as np


class BaseShotClassificationInference:
  """Interface that must be implemented for support of different model types."""

  def __init__(self, frozen_graph_path: str, label_map_path: str,
               config: ShotClassificationConfig):
    """Constructor for BaseShotClassificationInference.

    Args:
      frozen_graph_path: String value for the file path of frozen graph.
      label_map_path: String value for the file path of the label map.
      config: ShotClassificationConfig object with shot classification configs.
    """
    raise NotImplementedError()

  def input_size(self) -> Size:
    """Calculate / grab optimal input size.

    The user is expected to ensure the size of their input image is correct.
    This is in case the user wants to do any acceleration of image resizing
    themselves.

    Some inference engines require a specific input image size such as the
    TFLite models, however some Tensorflow models accept a dynamic input. For
    a dynamic input, the size outputed will have the dimensions -1, -1.

    Returns:
      The expected input size, of the type Size.
    """

# Path: automl_video_ondevice/shot_classification/config.py
# class ShotClassificationConfig:
#   device: str = ""
# 
#   # Number of highest scoring labels to output.
#   # If max_results is -1 then all labels are used.
#   top_k: int = 5
# 
#   # Only labels with scores > threshold are output.
#   score_threshold: float = 0.0
# 
#   # Outputs duplicate results for several frames.
#   # Predictions from the classification model is done every 25 frames. If
#   # duplicate_results is true then each 25 frame input will return the previous
#   # output, otherwise the output array will be have a single None value.
#   duplicate_results: bool = False
# 
#   # Waits this number of frames before running inference.
#   # This is ignored by the LSTM model.
#   inference_rate: int = 25
# 
#   # Sliding window size.
#   # This is ignored by the LSTM model.
#   sliding_window_size: int = 64
# 
# Path: automl_video_ondevice/types.py
# class ShotClassificationAnnotation:
#   timestamp: float
#   class_name: str
#   confidence_score: float
# 
# Path: automl_video_ondevice/types.py
# class Size:
#   width: int
#   height: int


# Path: automl_video_ondevice/shot_classification/base_shot_classification.py
from typing import List
from typing import Union
from automl_video_ondevice.shot_classification.config import ShotClassificationConfig
from automl_video_ondevice.types import ShotClassificationAnnotation
from automl_video_ondevice.types import Size
import numpy as np



class BaseShotClassificationInference:
  """Interface that must be implemented for support of different model types."""

  def __init__(self, frozen_graph_path: str, label_map_path: str,
               config: ShotClassificationConfig):
    """Constructor for BaseShotClassificationInference.

    Args:
      frozen_graph_path: String value for the file path of frozen graph.
      label_map_path: String value for the file path of the label map.
      config: ShotClassificationConfig object with shot classification configs.
    """
    raise NotImplementedError()

  def input_size(self) -> Size:
    """Calculate / grab optimal input size.

    The user is expected to ensure the size of their input image is correct.
    This is in case the user wants to do any acceleration of image resizing
    themselves.

    Some inference engines require a specific input image size such as the
    TFLite models, however some Tensorflow models accept a dynamic input. For
    a dynamic input, the size outputed will have the dimensions -1, -1.

    Returns:
      The expected input size, of the type Size.
    """

    return Size(256, 256)