Esempio n. 1
0
        input_dataframe = pandas.read_csv(input_file)
        value = np.array(input_dataframe['value'])
        prediction = np.array(input_dataframe['prediction'])
        prediction = np.array(input_dataframe['prediction'])
        label = np.array(input_dataframe['label'])
        prediction_training = np.array(input_dataframe['prediction_training'])

        prediction_training_stops = 0
        for i in range(0, len(prediction_training)):
            if prediction_training[i] == 1:
                prediction_training_stops += 1

        testing_value = value[prediction_training_stops:]
        testing_prediction = prediction[prediction_training_stops:]

        detector_instance = detector.detector(values=testing_value,
                                              predictions=testing_prediction)
        warp_distance = detector_instance.calculate_distances(
            comparision_window_size=dtw_window_size)
        threshold = detector_instance.set_threshold(
            training_ratio=training_ratio,
            max_multipler=threshold_max_multipler)
        positive_detection = detector_instance.get_anomalies()

        threshold_training_starts = prediction_training_stops
        threshold_training_size = int(len(testing_value) * training_ratio)

        threshold_ignore = np.zeros(threshold_training_starts)
        threshold_training = np.ones(threshold_training_size)
        threshold_testing = np.zeros(
            len(value) - threshold_training_starts - threshold_training_size)
        threshold_training_colomn = np.append(threshold_ignore,
from utils import visualization_utils as vis_util
import numpy as np
import cv2
from detector import detector
from imutils import paths
import os
import time



det = detector.detector()

image_folder = 'data_voc'

#imagePaths = paths.list_images(image_folder)
imageNames = os.listdir(image_folder)

# loop over the image paths
for imageName in imageNames:

    #print(imageName)

    image = cv2.imread(image_folder + '/' + imageName)
    print(image_folder + '/' + imageName)

    h, w = image.shape[:2]

    (boxes, scores, classes, num, category_index) = det.detect_plate(image)

    # print(category_index)