Skip to content

Conversation

@leoheim
Copy link
Contributor

@leoheim leoheim commented Sep 4, 2025

Summary

Mentor: '@SHIVAMBASIA'

This PR adds comprehensive TensorFlow/Keras model wrappers with OpenVINO optimization for the GSoC 2025 "AI PC Model Training Kit" project. These wrappers enable developers to train, evaluate, and deploy deep learning models locally using OpenVINO's optimized backend and Intel Extension for TensorFlow (ITEX).

Key Features

  • TensorFlow wrappers for classification, regression, segmentation, and detection
  • Automatic OpenVINO optimization via Intel Extension for TensorFlow (ITEX)
  • Quantization support: Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT)
  • Model persistence: TensorFlow SavedModel format with OpenVINO IR export
  • Built-in metrics: accuracy, F1, precision, recall, IoU, Dice, mAP, etc.
  • Inference modes: synchronous and asynchronous with OpenVINO Runtime

Supported Models

TensorFlow/Keras: Any tf.keras.Model (e.g., ResNet, UNet, MobileNet, custom architectures) via task-specific wrappers:

  • ClassificationWrapper: Image/text classification with comprehensive metrics
  • RegressionWrapper: Regression tasks with MSE, MAE, R² evaluation
  • SegmentationWrapper: Semantic segmentation with IoU and Dice metrics
  • DetectionWrapper: Object detection with custom metric support
  • BaseWrapper: Core functionality for any TensorFlow model

How to Test

Basic Classification Example

import tensorflow as tf
from ov_training_kit.tensorflow import ClassificationWrapper

# Create model
model = tf.keras.Sequential([
    tf.keras.layers.Conv2D(32, 3, activation='relu', input_shape=(224, 224, 3)),
    tf.keras.layers.GlobalAveragePooling2D(),
    tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy')

# Wrap and train
wrapper = ClassificationWrapper(model)
wrapper.fit(x_train, y_train, epochs=5, validation_data=(x_val, y_val))

# Evaluate with built-in metrics
accuracy = wrapper.evaluate_accuracy(x_test, y_test)
f1_score = wrapper.evaluate_f1(x_test, y_test, average='macro')
print(f"Accuracy: {accuracy:.3f}, F1: {f1_score:.3f}")

@leoheim leoheim requested a review from a team as a code owner September 4, 2025 01:11
@alvoron alvoron enabled auto-merge (squash) September 10, 2025 18:37
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Sep 11, 2025
@alvoron alvoron disabled auto-merge September 11, 2025 09:14
@alvoron alvoron merged commit 81ba7e0 into openvinotoolkit:master Sep 11, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants