buddy-compiler / buddy-benchmark

Benchmark Framework for Buddy Projects
Apache License 2.0
44 stars 34 forks source link

Fix classification bug for ResNet18DefaultBenchmark #54

Closed xlinsist closed 1 year ago

xlinsist commented 1 year ago

This change is based on this PR from buddy-mlir.

Change the input data layout from NHWC to NCHW to fix the classification bug of ResNet18DefaultBenchmark.

Pytorch is using NCHW to store image input. Since ResNet18DefaultBenchmark is based on 'ResNet-18.mlir' which is converted from a torch model, the input's layout should also be NCHW instead of the default setting NHWC in ImgContainer. After modification the following correct output of ResNet18DefaultBenchmark can be reached:

Classification Index: 208
Classification: Labrador retriever
Probability: 0.348121

For other deep learning benchmarks, data layouts are also explictly given to avoid confusion.

meshtag commented 1 year ago

Thanks for the PR! I will move ahead with the review once this PR lands.