Change language

Python4Delphi with Python AI Library Demo 01: Keras

Python4Delphi with Python AI Library Demo 01: Keras

Hello, everyone! Good morning, good afternoon, or good evening wherever youre joining us from.

My name is Muhammad Azizul Hakim.

You can call me Muhammad or Aziz for short.

I am a Python Technical Writer at Embarcadero Technologies.

Welcome to Python4Delphi with Python AI Library demo series! This is the first video of the series.

In this video, we will demonstrate how well Python4Delphi will bridge the two programming language giants.

Delphi and Python.

Delphi will give Python great GUI capabilities.

And on the other hand, through Python-with its numerous Data Science, Machine Learning, or AI libraries, you can consume any Data Science, Machine Learning, or AI functionalities to your Delphi programs.

The first library that we will show you is Keras.

Keras is a high-level neural networks API for Python, which acts as an interface for the TensorFlow library.

To give you some insights about how the performance of this demo on your system, here I share with you briefly about my working environment.

For the hardware: I use a laptop with an Intel Core i5 Processor 12 GB of RAM, and Intel UHD Graphics 620 for the graphic card.

For the OS, I use Windows 10 Home Edition.

According to my experiences, this demo also works well with lower specs.

For the Python version, I use Python version 3.8, which I find as a stable version when I work with Python4Delphi and combine it with other libraries.

And for the prerequisites, first, you need Python4Delphi installed on your system.

For the installation guide, you can follow the YouTube video by Jim McKeeth, which I also put the link on the description.

Second, install the required library.

If you haven’t installed it, you can easily install it with this pip command.

Another prerequisite is, you need to put the path where the required library is installed to the System Environment Variables.

Here are the examples of those paths: And, let’s get started! The credit for the code example used in this demo belongs to François Chollet, the creator of Keras, and author of Deep Learning with Python’.

A brief information about the dataset we use here, in this tutorial, we will use the famous Kaggle’s Cats vs Dogs binary classification dataset.

The image dataset is around 787 Mb, which you can download as zipped raw data.

You can download the data simply by running this curl command on your command prompt.

Here is how the download progress would look like on your command prompt.

You can also read more about this in our blog post at pythongui.org, the link in our description.

Next, unzip the dataset with this command With the ls command, now we can see that PetImages folder that contains two subfolders, Cat and Dog.

Each subfolder contains image files for each category.

Let’s see.

This is actually a really cool dataset.

It contains thousands of images of cats and dogs.

A rich dataset for image processing, computer vision, or deep learning.

Lets back to our slide.

The following is a code example of Keras to prepare and visualize the famous Kaggles Cats vs Dogs dataset for Deep Learning.

Before running any code, make sure the PetImages folder already in the same directory with your Python4Delphi Demo01.exe file.

Here it is.

Let’s copy-paste and run this code inside the lower Memo of our Python4Delphi first Demo GUI.

And click execute script.

It will take a moment to completely show the results.

So, let’s grab a cup of coffee! And here it is! A pretty cool images just shown up.

Lets see the results.

We successfully visualize the dataset, The pet images with their encodings.

Cat as 0, and dog as 1.

And another output inside the upper memo is telling us about: We have deleted 0 images data.

Our image dataset in total are about 23,000 pet image files that belonging to 2 classes (cat vs dog).

We use 80% of the data as training data and the rest 20% for testing or validation.

That’s it! Congratulations, you are successfully empowering the Windows GUI apps with Python’s Keras library.

In the last slide, we compile some links for you to read further, if you encounter any problems.

See you in the next demo! Thanks for watching!

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method