Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with graph_alexnet.cpp #1094

Open
sdavejones opened this issue Feb 17, 2024 · 5 comments
Open

Problem with graph_alexnet.cpp #1094

sdavejones opened this issue Feb 17, 2024 · 5 comments

Comments

@sdavejones
Copy link

I tried running this example in version 24.01:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/running-alexnet-on-raspberry-pi-with-compute-library

./graph_alexnet --data=$PATH_ASSETS --image=$PATH_ASSETS/go_kart.ppm --labels=$PATH_ASSETS/labels.txt

./graph_alexnet

Threads : 1
Target : Neon
Data type : F32
Data layout : NHWC
Tuner enabled? : false
Cache enabled? : false
Tuner mode : Normal
Tuner file :
MLGO file :
Fast math enabled? : false
Data path : /root/assets_alexnet
Image file : /root/assets_alexnet/go_kart.ppm
Labels file : /root/assets_alexnet/labels.txt

---------- Top 5 predictions ----------

0.3899 - [id = 496], n03026506 Christmas stocking
0.0862 - [id = 658], n03775071 mitten
0.0749 - [id = 806], n04254777 sock
0.0225 - [id = 474], n02963159 cardigan
0.0221 - [id = 893], n04548362 wallet, billfold, notecase, pocketbook

Test passed

Looks like the output isn't quite correct...

@morgolock
Copy link

Hi @sdavejones

Could you please let us know what's in the folder Data path : /root/assets_alexnet ?

If you don't specify the folder to the model's correct weights the example will initialize the weights with random values and the results won't be correct.

We don't distribute the weights files npy files along with the graph examples so this is not going to work out of the box.

Hope this helps

@sdavejones
Copy link
Author

Hi @morgolock

As mentioned, I followed that example. There's a paragraph in the content of that web page that says:
"Please download the required files to your host machine (Debian based) or to your Raspberry Pi"

I downloaded the file from here:
https://developer.arm.com/-/media/43359E999DEF433BAF63523C529D21AD.ashx?revision=c1a232fa-f328-451f-9bd6-250b83511e01

Thanks.

@sdavejones
Copy link
Author

Tested same example in v23.11:

./graph_alexnet --data=$PATH_ASSETS --image=$PATH_ASSETS/go_kart.ppm --labels=$PATH_ASSETS/labels.txt

./graph_alexnet

Threads : 1
Target : Neon
Data type : F32
Data layout : NHWC
Tuner enabled? : false
Cache enabled? : false
Tuner mode : Normal
Tuner file :
MLGO file :
Fast math enabled? : false
Data path : /root/assets_alexnet
Image file : /root/assets_alexnet/go_kart.ppm
Labels file : /root/assets_alexnet/labels.txt

---------- Top 5 predictions ----------

0.9736 - [id = 573], n03444034 go-kart
0.0118 - [id = 518], n03127747 crash helmet
0.0108 - [id = 751], n04037443 racer, race car, racing car
0.0022 - [id = 817], n04285008 sports car, sport car
0.0006 - [id = 670], n03791053 motor scooter, scooter

Test passed

You can see that the result matches the example....

@noahbreit
Copy link

Hi @morgolock I have the same issue as @sdavejones.
Note I am implementing this on a RPi-4B and using pre-built RPi-4 ACL binary, and I have a hunch that this is the source of the problem as it differs from the tutorial mentioned here https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/running-alexnet-on-raspberry-pi-with-compute-library. It was originally for "Raspberry Pi 2 or 3 with Ubuntu Mate 16.04.02"

Thoughts? Note I have attempted ACL-neon and ACL-neon-cl, both give the same result with go-kart.ppm input giving the christmas-stocking label output

also:
$ strings arm_compute_version-23.11-bin-linux-arm64-v8a-neon/lib/arm64-v8a-neon-asserts/libarm_compute.so | grep arm_compute_version
arm_compute_version=v23.11 Build options: {'arch': 'arm64-v8a', 'neon': '1', 'opencl': '0', 'os': 'linux', 'build_dir': 'arm-v8a-neon-asserts', 'asserts': '1', 'Werror': '1', 'embed_kernels': '1'}

@noahbreit
Copy link

Update! I changed to ACL ver22.11 and it worked.
I got the expected output for all of the provided ppm images from the tutorial.

for ref:
$ strings lib/arm64-v8a-neon/libarm_compute.so | grep arm_compute_version
arm_compute_version=v22.11 Build options: {'embed_kernels': '1', 'os': 'linux', 'opencl': '0', 'neon': '1', 'build_dir': 'arm64-v8a-neon', 'asserts': '0', 'arch': 'arm64-v8a', 'Werror': '1'}

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

No branches or pull requests

3 participants