How To Make A State-Of-The-Art Deep Learning App With Fastai
Did you know it’s easy to make use of some truly excellent Python libraries to super-charge your Delphi app development on Windows? Adding Python to your toolbox of Delphi code can enhance your app development, bringing in new capabilities which help you provide innovative and powerful solutions to your app’s users, which combine the best of Python with the supreme low-code and unparalleled power of native Windows development you get with Delphi. Are you looking for how to build a GUI for a powerful AI library? You can build a state-of-the-art deep learning solution with fastai on Delphi. This post will show you how to build a Delphi GUI app, dedicated to the fastai library. Watch this video by Jim McKeeth, as a comprehensive introduction about why you can love both Delphi and Python at the same time: What is the fastai library? fastai is a deep learning library that provides practitioners with high-level components that can quickly and easily provide state-of-the-art results in standard deep learning domains and provides researchers with low-level components that can be mixed and matched to build new approaches. It aims to do both things without substantial compromises in ease of use, flexibility, or performance. fastai includes: A new type dispatch system for Python along with a semantic type hierarchy for tensors A GPU-optimized computer vision library that can be extended in pure Python An optimizer which refactors out the common functionality of modern optimizers into two basic pieces, allowing optimization algorithms to be implemented in 4–5 lines of code A novel 2-way callback system that can access any part of the data, model, or optimizer and change it at any point during training A new data block API And much more… And the best of it is, fastai is organized around two main design goals: to be approachable and rapidly productive, while also being deeply hackable and configurable. fastai is built on top of a hierarchy of lower-level APIs which provide composable building blocks. This way, a user wanting to rewrite part of the high-level API or add particular behavior to suit their needs does not have to learn how to use the lowest level. Hierarchy of fastai APIs. How do I install the fastai Library? You can easily install fastai with pip: Or, if you are using Anaconda Python distribution, you can use this command to avoid complexities and conflicts between required libraries: conda install -c fastai -c pytorch -c anaconda -c conda-forge fastai gh anaconda conda install –c fastai –c pytorch –c anaconda –c conda–forge fastai gh anaconda How do I build a Delphi GUI for the fastai library? The following is the user interface structure for our project: User interface structure for our fastai4D project. Here is the list of Components used in the fastai4D demo app: TPythonEngine TPythonModule TPythonType TPythonVersions TPythonGUIInputOutput TForm TMemo TOpenDialog TSaveDialog TSplitter TImage TPanel TLabel TComboBox TButton Navigate to the UnitFastai4D.pas, and add the following line to the FormCreate, to load our basic fastaiApp.py: Memo1.Lines.LoadFromFile(ExtractFilePath(ParamStr(0)) + ‘fastaiApp.py’); Memo1.Lines.LoadFromFile(ExtractFilePath(ParamStr(0)) + ‘fastaiApp.py’); You can seamlessly load the fastai app python file inside the UnitFastai4D.pas file. And make sure that the fastaiApp.py is in the same directory as our Fastai4D.exe or inside your Delphi project folder. You can change the “fastaiApp.py” with any fastai script you […]
