Beispiel #1
0
                    rs(interpreter.get_tensor(output_details[2]['index']))]
    

    #output_data = interpreter.get_tensor(output_details[0]['index'])
    print('output_data shape is ', output_data.shape)
    print('output data is ', output_data)
    #results = np.squeeze(output_data)

    #top_k = results.argsort()[-5:][::-1]
    #print('top_k = ', top_k)
    labels = load_labels(args.label_file)
    print(labels)

    
    yolo = YOLO(0.6, 0.5)
    boxes, classes, scores = yolo.predict(input_data, image.size, outs = output_data)
    #print(boxes)

    if boxes is not None:
        draw(image, boxes, scores, classes, labels)

    image = image.save('detected.jpg')
    '''

    
    for i in top_k:
        if floating_model:
            print('i=', i)
            print('reslut[i] = ', results[i])
            print('labels[i] = ', labels[i])
            #print('{:08.6f}: {}'.format(float(results[i]), labels[i]))
Beispiel #2
0
    dictionary = {
        "front": 0,
        "front-side": 1,
        "rear": 2,
        "rear-side": 3,
        "side": 4
    }
    x_train = []
    y_train = []
    for folder in folders:
        images = os.listdir(path + "\\" + folder)
        for image in images:
            im_path = path + "\\" + folder + "\\" + image
            image = cv2.imread(im_path)
            pimage = process_image(image)
            boxes, classes, scores = yolo.predict(pimage, image.shape)
            #det_image = detect_image(image, yolo, all_classes)
           # cv2.imshow("detected", det_image)
            if classes is None:
                print(im_path)
                continue
            S = 0
            maxBox = []

            if boxes is None:
                print(im_path)
                continue

            for box in boxes:
                x, y, w, h = box
                if w * h > S: