analogdevicesinc / ai8x-synthesis

Quantization and Synthesis (Device Specific Code Generation) for ADI's MAX78000 and MAX78002 Edge AI Devices
Apache License 2.0
55 stars 49 forks source link

--sample-input doesn't work for me #274

Closed Doruk-Dilmen closed 1 year ago

Doruk-Dilmen commented 1 year ago

Hi,

I am trying to synthesis part with --sample-input. I created sample_kws_20.npy , using --save-sample 10argument. However, I take this returned. image

aniktash commented 1 year ago

Make sure you have quantized the checkpoint and that you are using the quantized checkpoint to evaluate, create sample data and synthesize. Also, to create the sample data, you should use -8 (similar to the evaluation script).

Doruk-Dilmen commented 1 year ago

Thank you.

I want to ask one more thing. I am using --save-sample 10 argument. What's in class 10.? Which class?

aniktash commented 1 year ago

The index used in --save-sample is not the class, it's the index to a sample data in the dataloader. So, you cannot quickly figure out which class that sample is taken from.

Doruk-Dilmen commented 1 year ago

Okey, I got it but how can I know my network is working correctly. I think I should know which class that sample is taken from. Then I have to check if this is true. Finally, based on the result of this, I decide whether my network is working correctly or not.

aniktash commented 1 year ago

The purpose of this sample data is to integrate with the c code and test it on HW as the known answer test. A pass means that the network on HW behaves exactly the same as your model. You can evaluate your model independently to see if it works correctly. You also can manually convert a 1sec wav to a 128x128 tensor saved as .npy for sample data. Keep in mind that sequential audio samples range are stored in columns in the tensor and are in [-128,127] range. A notebook example is provided here and can evaluate the sample data file: https://github.com/MaximIntegratedAI/ai8x-training/blob/develop/notebooks/KWS_Audio_Evaluation.ipynb. You can also see how it converts the .wav to (128,128) samples in evaluate function. It can conveniently stored as sample_data.npy

github-actions[bot] commented 1 year ago

This issue has been marked stale because it has been open for over 30 days with no activity. It will be closed automatically in 10 days unless a comment is added or the "Stale" label is removed.

rotx-eva commented 1 year ago

Please also see https://github.com/MaximIntegratedAI/ai8x-training/pull/201. If that doesn't address it, please open a new issue in that repo.