AxisCommunications / acap-native-sdk-examples

Example code for APIs and features in AXIS Camera Application Platform (ACAP) Native SDK
Apache License 2.0
41 stars 23 forks source link

How to train dataset for object_detection #156

Closed takuya-takeuchi closed 11 months ago

takuya-takeuchi commented 11 months ago

Describe the feature

How to train object detection model? There is no information in this repo.

Added value

https://github.com/AxisCommunications/acap-native-sdk-examples/tree/main/object-detection uses models of https://github.com/google-coral/test_data so I think model would be generated from https://github.com/tensorflow/models But I'm not sure it is correct. In convlustion, I want to know

Additional context

N/A

shreyasatwork commented 11 months ago

Hello,

Thanks for your question!

Although we don't specifically provide training scripts for object detection models, we do it for an object classification model in tensorflow-to-larod, tensorflow-to-larod-artpec8, tensorflow-to-larod-cv25, they also provide the conversion script to convert the resulting model to tflite format.

takuya-takeuchi commented 11 months ago

@shreyasatwork thanks quick response.

After read above code and README, I have some question about TF.

On https://github.com/AxisCommunications/acap-native-sdk-examples/issues/61, it is said that TF2 is not supported. TF1 is too old. Most of current models targets modern framework. They would support conversion model except for TF1. Is there any plan to support TF2?

Or

The ARTPEC-8 DLPU uses per-tensor quantization, as opposed to per-axis quantization. This needs to be taken into account when choosing how to train the model, as the per-tensor quantization scheme strongly favours quantization-aware training. Because of this, quantization-aware training is used in the training script for this tutorial. Currently, per-tensor quantization is not supported in Tensorflow 2.x, which is why the tf.contrib.quantize module from Tensorflow 1.15 is used to perform the quantization-aware training.

Does it mean TF2 is supported in axis if not using quantization ?

Corallo commented 11 months ago

Hi @takuya-takeuchi

Artpec-8 device support Tensorflow 2, but they are not optimized for the Tensorflow 2 quantization technique. You could still try to use a model quantized with TF2, but you will encounter both speed and accuracy degradation. Depending on the type of model you use, this performance degradation can be more or less strong. So we do not recommend it.

You could however run a TF2 model with and without quantization using the CPU of the device, if you accept the lower speed.

pataxis commented 11 months ago

Seems like the question was answered, will close the issue.