fast_style_transfer_flutter 0.0.2 copy "fast_style_transfer_flutter: ^0.0.2" to clipboard
fast_style_transfer_flutter: ^0.0.2 copied to clipboard

A Flutter package for running **Fast Neural Style Transfer** using **TensorFlow Lite (TFLite)** models, enabling real-time image transformation on **Android** and **iOS** devices **locally** (no inter [...]

Fast Style Transfer Flutter 🎨 #

A Flutter package for running Fast Neural Style Transfer using TensorFlow Lite (TFLite) models, enabling real-time image transformation on Android and iOS devices locally (no internet connection required).

πŸ’‘ Based on the original Fast Style Transfer by Logan Engstrom and inspired by luiscib3r/style_transfer. Special thanks to them!


🧠 How It Works #

  1. Loads two models:
    • predict.tflite: extracts style features
    • transfer.tflite: applies style to the input image
  2. Preprocesses the input content & style images
  3. Runs both models sequentially
  4. Returns JPEG-encoded image as Uint8List

πŸ“‚ Supported Model Loading #

You can load models from:

  • Assets (recommended)
  • File path (File)
  • Raw bytes (Uint8List)

πŸš€ Installation #

dependencies:
   fast_style_transfer_flutter: ^0.0.2

πŸ“Έ Example #

final styleTransfer = FastStyleTransferFlutter.init(
  config: FastStyleTransferConfig(
    thread: 4,
    useGPU: true,
    loaderConfig: FastStyleAssetsLoaderConfig(
      predictResource: 'models/predict.tflite',
      styleTransferResource: 'models/transfer.tflite',
    ),
  ),
);

final resultImage = await styleTransfer.run(
  request: RunTransferRequest(
    image: imageBytes, // content image (Uint8List)
    style: styleBytes, // style image (Uint8List)
  ),
);

// Use resultImage as Uint8List (e.g., display or save)

πŸ“Έ Screenshots #

[Screen 1] [Screen 2] [Screen 3] [Screen 3]


πŸ“₯ Model Download #

You can use pre-trained models provided by TensorFlow:

These models are compatible with this package and ready to be used.

You can also train or convert your own models based on:

πŸ™ Credits #

  • Huge thanks to Logan Engstrom for the original Fast Style Transfer.
  • Special appreciation to luiscib3r for mobile adaptation inspiration and open-source contribution.
2
likes
125
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for running **Fast Neural Style Transfer** using **TensorFlow Lite (TFLite)** models, enabling real-time image transformation on **Android** and **iOS** devices **locally** (no internet connection required).

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, image, tflite_flutter

More

Packages that depend on fast_style_transfer_flutter