Skip to content

Commit

Permalink
Added demo for TensorFlow. And fix accuracy-checker for TF2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav-Denisov committed Sep 26, 2024
1 parent 2ccd06f commit 742d1f2
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
17 changes: 17 additions & 0 deletions demo/accuracy_checker_configs/TensorFlow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Tests>
<Test>
<Model>
<Task>classification</Task>
<Name>SampleNet</Name>
<Precision>FP32</Precision>
<SourceFramework>TensorFlow</SourceFramework>
<Directory>/media/models</Directory>
</Model>
<Parameters>
<InferenceFramework>TensorFlow</InferenceFramework>
<Device>CPU</Device>
<Config>{CONFIG_PATH}</Config>
</Parameters>
</Test>
</Tests>
31 changes: 31 additions & 0 deletions demo/accuracy_checker_configs/TensorFlow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
models:
- name: SampLeNet_example
launchers:
- framework: tf2
device: CPU
model: saved_model.pb
saved_model_dir: samplenet_tf2/
adapter: classification
batch: 1

datasets:
- name: sample_dataset
data_source: sample_dataset/test
annotation_conversion:
converter: cifar
data_batch_file: cifar-10-batches-py/test_batch
convert_images: True
converted_images_dir: sample_dataset/test
num_classes: 10

preprocessing:
- type: resize
size: 32
- type: bgr_to_rgb
- type: normalization
mean: (125.307, 122.961, 113.8575)
std: (51.5865, 50.847, 51.255)

metrics:
- type: accuracy
top_k: 1
36 changes: 36 additions & 0 deletions demo/benchmark_configs/TensorFlow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Tests>
<Test>
<Model>
<Task>classification</Task>
<Name>SampleNet</Name>
<Precision>FP32</Precision>
<SourceFramework>TensorFlow</SourceFramework>
<ModelPath>/media/models/samplenet_tf2/saved_model.pb</ModelPath>
<WeightsPath>/media/models/samplenet_tf2/saved_model.pb</WeightsPath>
</Model>
<Dataset>
<Name>ImageNET</Name>
<Path>/tmp/{DLI_DATASET_REPO_NAME}/Datasets/ImageNET/</Path>
</Dataset>
<FrameworkIndependent>
<InferenceFramework>TensorFlow</InferenceFramework>
<BatchSize>1</BatchSize>
<Device>CPU</Device>
<IterationCount>10</IterationCount>
<TestTimeLimit>0</TestTimeLimit>
</FrameworkIndependent>
<FrameworkDependent>
<ChannelSwap></ChannelSwap>
<Mean></Mean>
<InputScale></InputScale>
<InputShape>32 32 3</InputShape>
<InputName></InputName>
<OutputNames></OutputNames>
<ThreadCount></ThreadCount>
<InterOpParallelismThreads></InterOpParallelismThreads>
<IntraOpParallelismThreads></IntraOpParallelismThreads>
<KmpAffinity></KmpAffinity>
</FrameworkDependent>
</Test>
</Tests>
2 changes: 1 addition & 1 deletion src/accuracy_checker/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, log, executor, test):
self._test = test
self._output = None
self._status = None
self.supported_frameworks = {'OpenVINO DLDT': 'dlsdk', 'Caffe': 'caffe', 'TensorFlow': 'tf',
self.supported_frameworks = {'OpenVINO DLDT': 'dlsdk', 'Caffe': 'caffe', 'TensorFlow': 'tf2',
'TensorFlow_Lite': 'tf_lite', 'MXNet': 'mxnet', 'OpenCV': 'opencv',
'PyTorch': 'pytorch', 'TVM': 'tvm', 'ONNXRuntime': 'onnx_runtime'}
self.csv_name = executor.get_csv_file()
Expand Down

0 comments on commit 742d1f2

Please sign in to comment.