ZhaoqxCN / PYNQ-CNN-ATTEMPT

Some attempts to build CNN on PYNQ.
MIT License
24 stars 6 forks source link

Steps for using same netwrok for classification of new data #7

Open shobhitt10 opened 2 years ago

shobhitt10 commented 2 years ago

Hi, Thanks for your constant support. I am able to run FPGA_CNN successfully.

Now, I want to classify some other data by using the same network structure as yours (CNN_MNIST). What are the steps to follow to do this?

Do I also need to change something on vivado side or the same overlay(cnn.bit) can be reused irrespective of the data to be classified and just the trained model (h5) needs to be the new one.

Can you please guide me on the steps for having a novel application?

ZhaoqxCN commented 2 years ago

If your data size and network structure is exactly the same as mine, you can just run your new network model by replacing the .h5 file, otherwise you will need to regenerate the IP files via HLS to adapt your model and regenerate the .bit and .tcl files in vivado.

nagendra7890 commented 2 years ago

Hi, Thanks for your constant support. I am able to run FPGA_CNN successfully.

Now, I want to classify some other data by using the same network structure as yours (CNN_MNIST). What are the steps to follow to do this?

Do I also need to change something on vivado side or the same overlay(cnn.bit) can be reused irrespective of the data to be classified and just the trained model (h5) needs to be the new one.

Can you please guide me on the steps for having a novel application?

Hi @shobhitt10

can you please explain me how did you load your weights using overlay?

shobhitt10 commented 2 years ago

Hi, Thanks for your constant support. I am able to run FPGA_CNN successfully. Now, I want to classify some other data by using the same network structure as yours (CNN_MNIST). What are the steps to follow to do this? Do I also need to change something on vivado side or the same overlay(cnn.bit) can be reused irrespective of the data to be classified and just the trained model (h5) needs to be the new one. Can you please guide me on the steps for having a novel application?

Hi @shobhitt10

can you please explain me how did you load your weights using overlay?

Hi @nagendra7890, I have not used my overlay yet. I meant that I could successfully use the overlay provided in the repo. First I am trying to build the block diagram by using the IP here then I shall try modifying the hls code for the cnn. But, my target is same as yours i.e. accelerate my own custom cnn for other dataset

nagendra7890 commented 2 years ago

Hi, Thanks for your constant support. I am able to run FPGA_CNN successfully. Now, I want to classify some other data by using the same network structure as yours (CNN_MNIST). What are the steps to follow to do this? Do I also need to change something on vivado side or the same overlay(cnn.bit) can be reused irrespective of the data to be classified and just the trained model (h5) needs to be the new one. Can you please guide me on the steps for having a novel application?

Hi @shobhitt10 can you please explain me how did you load your weights using overlay?

Hi @nagendra7890, I have not used my overlay yet. I meant that I could successfully use the overlay provided in the repo. First I am trying to build the block diagram by using the IP here then I shall try modifying the hls code for the cnn. But, my target is same as yours i.e. accelerate my own custom cnn for other dataset

Hi @shobhitt10

May i know which board did you use and did you modify anything while implementing ? because some libraries are not supporting like xlnk.

shobhitt10 commented 2 years ago

I am using pynq-z2. And for that xlnk, use pynq image v2.5 because it got deprecated from 2.6

nagendra7890 commented 2 years ago

Hi, I was not able to install tensorflow using pynq image v2.5 so i need to use theono. did you use tensorflow or theono? can you guide me how did you install those frameworks and which versions did you use ?

nagendra7890 commented 2 years ago

Hi @shobhitt10

can you please guide me to install theono and which version did you installed?

shobhitt10 commented 2 years ago

Hi @shobhitt10

can you please guide me to install theono and which version did you installed?

Yes, you can install keras using pip. This might take a long time. Then You need to change the backend from tensorflow to theano for keras. For this, there are several guides on internet. If you can't find the json file. Try https://stackoverflow.com/questions/40310035/how-to-change-keras-backend-wheres-the-json-file

nagendra7890 commented 2 years ago

Hi @shobhitt10

I have modified cnn_minst according to my specifications but the output doesn't show up. it keeps running without showing any result. it got stuck in dma.recvchannel.wait().

if you give any suggestions it would be really helpful to me.

Thank you.

shobhitt10 commented 2 years ago

Hi @nagendra7890

Sorry, but i don't think i can help in this. Maybe pynq support can help regarding this dma issue.

nagendra7890 commented 2 years ago

Hi @shobhitt10

Actually, the problem is in my HLS code. I have modified the HLS C++ code according to my algorithm but some functions i keep as same because I am not sure what that code do exactly.

1.#pragma HLS array_partition variable = B block factor = KerDim dim = 4 .  
2.#pragma HLS array_partition variable = A block factor = InCH dim = 1 
3.#pragma HLS array_partition variable = A block factor = InCH/16 dim = 1 #pragma HLS array_partition variable = B block factor = InCH/16 dim = 2 

can you explain about this pragma and dimensions?