Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Apparent differences between results from cpu and edgetpu #92

Open
tino926 opened this issue Nov 23, 2021 · 1 comment
Open

Apparent differences between results from cpu and edgetpu #92

tino926 opened this issue Nov 23, 2021 · 1 comment

Comments

@tino926
Copy link

tino926 commented Nov 23, 2021

Hi, thanks for your wonderful work. However, I have got very different results from cpu and edgetpu. In the following image, left one is the result using cpu, and the right one is the result using edgetpu.
Untitled

These are the scripts I've used:

  1. convert weight to tflite and quantize:
from yolov4.tf import YOLOv4, YOLODataset, save_as_tflite

yolo = YOLOv4()

yolo.config.parse_names("test/coco.names")
yolo.config.parse_cfg("config/yolov4-tiny-relu-tpu.cfg")

yolo.make_model()
yolo.load_weights(
    "/home/hhk7734/NN/yolov4-tiny-relu.weights", weights_type="yolo"
)

dataset = YOLODataset(
    config=yolo.config,
    dataset_list="/home/hhk7734/NN/val2017.txt",
    image_path_prefix="/home/hhk7734/NN/val2017",
    training=False,
)

save_as_tflite(
    model=yolo.model,
    tflite_path="yolov4-tiny-relu-int8.tflite",
    quantization="full_int8",
    dataset=dataset,
)
  1. convert to edgetpu model:
    edgetpu_compiler -sa yolov4-tiny-relu-int8.tflite

  2. inference on cpu:

import cv2

from yolov4.tflite import YOLOv4

yolo = YOLOv4()

yolo.config.parse_names("test/coco.names")
yolo.config.parse_cfg("config/yolov4-tiny-relu-tpu.cfg")

yolo.summary()

yolo.load_tflite("yolov4-tiny-relu-int8.tflite")

yolo.inference("test/kite.jpg")
  1. inference on edgetpu:
import cv2

from yolov4.tflite import YOLOv4

yolo = YOLOv4()

yolo.config.parse_names("test/coco.names")
yolo.config.parse_cfg("config/yolov4-tiny-relu-tpu.cfg")

yolo.summary()

yolo.load_tflite("yolov4-tiny-relu-int8_edgetpu.tflite")

yolo.inference("test/kite.jpg")
@hhk7734
Copy link
Owner

hhk7734 commented Dec 2, 2021

Oh,,,
I don't know about that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants