What’s the Best Way to Run TensorFlow Models from GDScript in Godot?

Hello

I am trying to create smarter NPC behavior in Godot by using pre-trained machine learning models. :slightly_smiling_face:I would like to load & run inference from a TensorFlow model directly within Godot using GDScript but I am not sure how feasible / easy that is. Has anyone managed to hook up TensorFlow models to GDScript before? :thinking:

I found a promising addon called Godot TF Inference that seems to let you load and infer from TensorFlow SavedModels in GDScript; without needing to recompile the engine. :thinking:

It looks pretty handy but I am curious how well it works across platforms & whether there are performance hiccups or compatibility quirks I should be aware of. Has anyone used or tested this in their project? :thinking: Checked GitHub - ashtonmeuser/godot-tf-inference: Load and infer from TensorFlow models from GDScript guide for reference.

Also random thought I recently wondered what is TensorFlow and thinking about how it works under the hood made me realize that understanding its model formats and compatibility might help me better integrate it into Godot. :innocent:

If you have done something similar / know a good path forward, I would love to hear your setup tips or experiences!

Thank you !! :slightly_smiling_face:

Haven’t done it. I’ve thought about it. Someone posted about this project a few days ago.

Checkout this thread: Offline AI-Powered NPCs Teaching Sustainable Farming — Built with Godot 4.x and Gemma 3n

I took a look at the project. It’s 4 years old. That means this was developed off some version of 3.4. I doubt it’ll work without effort with 4.x.