Giter VIP home page Giter VIP logo

Comments (13)

MatthewARM avatar MatthewARM commented on August 15, 2024

Hi @liviolima80 the Caffe parser doesn't support the 'Data' layer: the supported layers are listed in CaffeSupport.md in the armnnCaffeParser source directory. However I am aware that we have a working test using Lenet. I'll find out which version of the model we're using and post back here.

from armnn.

liviolima80 avatar liviolima80 commented on August 15, 2024

Hi @MatthewARM ,
it should be great to have a documentation (and an example model) on how to configure the Caffe training in order to have a model that can be loaded with armnnCaffeParser.
If you download the AlexNet reference model on Caffe repository from

https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet

and you run ExecuteNetwork on the model with first layer named "data" and last layer named "prob" you have the following error:

Armnn Error: Couldn't find requested output layer 'prob' in graph

even if the "prob" layer is the last layer defined in the model as you can check in the deploy.prototxt

If I pass the prototxt file instead I have the following error:

Armnn Error: Expected data blob at index 0 in layer conv1 not found

Could you please verify these problems?

from armnn.

liviolima80 avatar liviolima80 commented on August 15, 2024

Hi @MatthewARM , any news?

from armnn.

TelmoARM avatar TelmoARM commented on August 15, 2024

Hi @liviolima80, I've been looking into the issues you reported and I will have some news for you today

from armnn.

TelmoARM avatar TelmoARM commented on August 15, 2024

Hi @liviolima80 ,

Apologies for the delay, I had to clarify a few things before I could provide a clear answer. I was able to reproduce the errors you reported.

1 - Passing a caffe-text input:

The error is because the .protoxt file doesn't have the weights included. In Tensorflow you can merge the network weights with the model definition in the .protoxt but Caffe doesn't really support this, it was an oversight on our side and we will be clarifying the expected behaviour on our next release. The caffe-binary input for Lenet is working, see below.

1.1 Armnn Error: Unsupported layer type 'Data'

It's case sensitive. Change the input layer to '-i data'

2 - Alexnet caffe-binary input not working.

I was able to reproduce this issue as well. We have an Alexnet test that runs fine outside the ExecuteNetwork app, so we must be doing something wrong in the app. I'll open a bug to investigate this further and we'll let you know of the outcome.

from armnn.

TelmoARM avatar TelmoARM commented on August 15, 2024

Hi again @liviolima80,

It appears that my 1.1 answer above is incorrect. That error is caused when you use a caffe .prototxt with the old syntax (which Armnn doesn't support). That can be easily fixed with something like:
import caffe
net = caffe.Net('old.prototxt', '.caffemodel', caffe.TEST)
net.save('new.caffemodel')

Let us know if that works

from armnn.

liviolima80 avatar liviolima80 commented on August 15, 2024

Hi @TelmoARM ,
first of all thanks for your reply, i'll try the python fix you suggest. The problem is that the loading of a caffe model in python does not work in windows, i have to do in linux

In the meantime, can you provide me the pyton code you use to build the model for train in caffe in order to create a model that works with armnn? I usually use the following

n = caffe.NetSpec()

n.data, n.label = L.Data(batch_size=batch_size, backend=P.Data.LMDB, source=lmdb, transform_param=dict(scale=1./255), ntop=2)

n.conv1 = L.Convolution(n.data, kernel_size=3, num_output=32, weight_filler=dict(type='xavier'))
n.relu1 = L.ReLU(n.conv1, in_place=True)
n.conv2 = L.Convolution(n.relu1, kernel_size=3, num_output=32, weight_filler=dict(type='xavier'))
n.relu2 = L.ReLU(n.conv2, in_place=True)
n.pool1 = L.Pooling(n.relu2, kernel_size=2, stride=2, pool=P.Pooling.MAX)

......

Thanks

from armnn.

liviolima80 avatar liviolima80 commented on August 15, 2024

Hi @TelmoARM ,
with your fix now the model works! Now I have another problem that the network output is wrong but probably I load the data to input tensor in wrong way. I need to investigate about this

Thank you

from armnn.

TelmoARM avatar TelmoARM commented on August 15, 2024

Hi @liviolima80 ,

Good to hear the fix worked.

I've also found the problem with Alexnet. The Alexnet deploy.prototxt has got the batch size set to 10 but Armnn uses batch size in the model and there's no way to override it, so we need to generate a new model with the batch size set to 1. To do this:

Open the Alexnet deploy.prototxt and change 'input_param { shape: { dim: 10 dim: 3 dim: 227 dim: 227 } }' to 'input_param { shape: { dim: 1 dim: 3 dim: 227 dim: 227 } }' and save it as Alexnet1.prototxt.

Run the following python script

import caffe

net = caffe.Net('deploy.prototxt', '/home/bvlc_alexnet.caffemodel', caffe.TEST)
new_net = caffe.Net('Alexnet1.prototxt', '/home/bvlc_alexnet.caffemodel', caffe.TEST)
new_net.save('bvlc_batchsize_1.caffemodel')

The new bvlc_batchsize_1.caffemodel runs through Armnn.

from armnn.

MatthewARM avatar MatthewARM commented on August 15, 2024

Closing this ticket as I believe both issues have been solved.

from armnn.

GarryLau avatar GarryLau commented on August 15, 2024

How to solve the problem ?Armnn Error: Couldn't find requested output layer 'prob' in graph. I used the trained caffemodel directly. Should I convert it OR use both develop.prototxt and trained caffemodel?@liviolima80

from armnn.

TelmoARM avatar TelmoARM commented on August 15, 2024

Hi Garry,

This ticket has been resolved. To help us diagnose the problem could you tell us if you are following any of the instructions in this thread?

Are you using the Execute Network app? If so, how are you using it?

The easiest way to address your issue would be to open a new ticket and provide the configuration, set-up and relevant information.

Thanks,
Telmo

from armnn.

GarryLau avatar GarryLau commented on August 15, 2024

@TelmoARM I have solved my problem. I have wrote a blog (of course in Chinese), and I put my codes in github.
I have put my code on Ambarella platform, and running successfully.
I think your document are too few, you should tell us we must convert the trained caffemodel to the inference caffemodel, and something important we need to attend to about cross compile. (I also wrote a blog about how to configure the develop environment about armnn sdk, compute library, protobuf and so on.)

from armnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.