def __init__(self, config, tracker_config):

        CPTVFileProcessor.__init__(self, config, tracker_config)

        self.hints = {}
        self.enable_track_output = True
        self.compression = (
            blosc_zstd if self.config.extract.enable_compression else None
        )

        self.previewer = Previewer.create_if_required(config, config.extract.preview)

        # normally poor quality tracks are filtered out, enabling this will let them through.
        self.disable_track_filters = False
        # disables background subtraction
        self.disable_background_subtraction = False

        os.makedirs(self.config.tracks_folder, mode=0o775, exist_ok=True)
        self.database = TrackDatabase(
            os.path.join(self.config.tracks_folder, "dataset.hdf5")
        )

        # load hints.  Hints are a way to give extra information to the tracker when necessary.
        # if os.path.exists(config.extract.hints_file):
        if config.extract.hints_file:
            self.load_hints(config.extract.hints_file)
Example #2
0
    def __init__(self, config, model=None):
        """Create an instance of a clip classifier"""

        self.config = config
        # super(ClipClassifier, self).__init__(config, tracking_config)
        self.model = model
        # prediction record for each track

        self.previewer = Previewer.create_if_required(config, config.classify.preview)

        self.high_quality_optical_flow = self.config.tracking.high_quality_optical_flow
        self.models = {}
Example #3
0
    def __init__(self, config, tracking_config):
        """ Create an instance of a clip classifier"""

        super(ClipClassifier, self).__init__(config, tracking_config)

        # prediction record for each track
        self.track_prediction: Dict[Track, TrackPrediction] = {}

        self.previewer = Previewer.create_if_required(config,
                                                      config.classify.preview)

        self.start_date = None
        self.end_date = None

        # enables exports detailed information for each track.  If preview mode is enabled also enables track previews.
        self.enable_per_track_information = False

        # writes metadata to standard out instead of a file.
        self.write_meta_to_stdout = False
    def __init__(self, config):

        self.config = config
        os.makedirs(self.config.tracks_folder, mode=0o775, exist_ok=True)
        self.database = TrackDatabase(
            os.path.join(self.config.tracks_folder, "dataset.hdf5"))

        self.compression = (tools.gzip_compression
                            if self.config.load.enable_compression else None)
        self.track_config = config.tracking
        # number of threads to use when processing jobs.
        self.workers_threads = config.worker_threads
        self.previewer = Previewer.create_if_required(config,
                                                      config.load.preview)
        self.track_extractor = ClipTrackExtractor(
            self.config.tracking,
            self.config.use_opt_flow
            or config.load.preview == Previewer.PREVIEW_TRACKING,
            self.config.load.cache_to_disk,
        )
    def __init__(self, config, tracking_config):
        """ Create an instance of a clip classifier"""

        super(ClipClassifier, self).__init__(config, tracking_config)

        # prediction record for each track
        self.predictions = Predictions(self.classifier.labels)

        self.previewer = Previewer.create_if_required(config,
                                                      config.classify.preview)

        self.start_date = None
        self.end_date = None
        self.cache_to_disk = self.config.classify.cache_to_disk
        # enables exports detailed information for each track.  If preview mode is enabled also enables track previews.
        self.enable_per_track_information = False
        self.track_extractor = ClipTrackExtractor(
            self.config.tracking,
            self.config.use_opt_flow
            or config.classify.preview == Previewer.PREVIEW_TRACKING,
            self.config.classify.cache_to_disk,
        )
Example #6
0
    def __init__(self, config, cache_to_disk=None):
        """Create an instance of a clip classifier"""

        self.config = config

        self.previewer = Previewer.create_if_required(config,
                                                      config.classify.preview)

        if cache_to_disk is None:
            self.cache_to_disk = self.config.classify.cache_to_disk
        else:
            self.cache_to_disk = cache_to_disk
        # enables exports detailed information for each track.  If preview mode is enabled also enables track previews.
        self.enable_per_track_information = False
        self.track_extractor = ClipTrackExtractor(
            self.config.tracking,
            self.config.use_opt_flow
            or config.classify.preview == Previewer.PREVIEW_TRACKING,
            self.cache_to_disk,
            high_quality_optical_flow=self.config.tracking.
            high_quality_optical_flow,
            verbose=self.config.verbose,
            keep_frames=False if self.previewer is None else True,
        )
Example #7
0
 def create_mp4(self):
     previewer = Previewer(self.config, "classified")
     previewer.export_clip_preview(self.clip.get_id() + ".mp4", self.clip,
                                   self.predictions)