Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
How-To'sShowcaseWebinar

Not a Hotdog! How to Use AI Object Recognition in Your Apps

not a hotdog how to use ai object recognition in your apps

I’m finally catching up with the articles to go with our Winter Webinars series. My guests and I have been showing you how to write genuine cross-platform low-code apps that do extraordinary things with just a few lines of code and get them to work on Windows, macOS, iOS, Android, and Linux. We will be back in the new year with more to come after our pause for the winter break. You can catch up with any you have missed either by going to the “Learn” tab on the RAD Studio Welcome Page or going direct to our YouTube channel which you can find here https://youtube.com/@EmbarcaderoTech/streams where you can also find a lot more content. I’ve already written about how to live track the International Space Station (ISS) with a couple of lines of code. The app I am describing today is also similarly low-code and very easy to write thanks to the Delphi AWS library from our wonderful Tech Partner Appercept. In fact, the AI object recognition part of it is only 10 lines of code. Yes, 10. That’s the power of RAD Studio with Delphi; it really could not be any easier, could it?

Why did you write an AI app which can only say that something is or is not a hotdog?

Not a Hotdog How to Use AI Object Recognition in Your Apps screengrab of the working app

Well, because I could. But also, because it’s a really good demonstration of the genuine power of Amazon’s AWS Rekognition service and the very easy to use AWS SDK from Appercept. Well, and because, as I’ve said before, I am enormous geek coupled with being a superfan of HBO’s hilarious TV comedy show Silicon Valley. Seriously, if you’ve never seen it before you must watch it because it pokes fun at the tech startup culture of Silicon Valley. There are several spoof apps which appear in the program. My two favorites are one called “Bro” which can only send the word “Bro” to your ‘Bro’ contacts and a fairly ill-conceived object recognition mobile app called “Seefood” (because it can see…food).

The Seefood app appears in series 4, episode 4 where it is created by the hapless Jian-Yang while he is living at Erlich Bachman’s ‘start-up incubator’. You only see it for a few seconds but the characters in Silicon Valley discuss it at length, mainly because instead of being what Erlich calls “the Shazam of food” it becomes apparent that the only thing ‘Seefood’ can actually do is identify if something is a hotdog, or, much frequently, not a hotdog. After the initial dismay that Erlich’s dreams of star-up unicorn success are once again thwarted, the rest of the Pied Piper developers point out that Jian-Yang has actually created an extremely useful AI image classifier (watch the episode to find out what happens after that).

In order to know something is NOT a hotdog you need to know what it is

That’s kind of the point. Buried in among the unending puns and dialog of the “not a hotdog” show episode is actually something profound; in order to know it is NOT a hotdog the app needs to know what it is ‘seeing’. You have to have an app that can use AI object recognition to examine any arbitrary photo or video the user chooses. It then needs to identify all the objects in the image and work out if any of them are hotdogs.

I saw this and thought, that’s actually a perfect opportunity to create a demo mobile app and play around with some AI. So, I did.

How to easily use AI in your mobile apps

Amazon have a quite incredible service called AWS Rekognition. The Rekognition service provides an extremely comprehensive set of features that go far beyond simple object recognition. They include face recognition with ‘face liveness’ to determine if a face is a genuine live human or something like a mask. It also provides analysis of the face to identify characteristics like approximate age, gender, emotions, and ‘landmarks’ like eyes and mouth. Added to this Rekognition has special advanced features like the ability to have a training set, for example well-known celebrities, that it can then later identify to satisfy your inner celebrity stalker. Perhaps most importantly it also can identify and label objects along with aliases (path, footpath, sidewalk etc) – which is the capability we’re interested in for this demo. It can also recognize nudity too which could be useful if you are trying to write an app which prevents people uploading inappropriate images to your website. The Appercept AWS SDK fully works with WebStencils too so you can easily create a website and with a few lines of code integrate fully-featured AI and Amazon AWS services into it. I do tell people Delphi is my superpower – I really mean it, why work any harder when it’s so easy to do with Delphi?

The remarkable thing about RAD Studio with Delphi is how powerful it is with so few lines of very easy code

Appercept’s AWS SDK allows you to use AWS Rekognition in your own RAD Studio with Delphi apps very easily. In fact, in my case, under 30 lines – and that’s including catering for the fact “hotdog” is spelled on the TV show as one word, but Amazon believes the correct spelling for the word is “hot dog” so I had to add some additional lines in to deal with that inconsistency. The actual code to do the AI object recognition is actually exactly ten lines of code. Isn’t that incredible?

Some things to know about the “Not a hotdog” app

Yes, it really is a fully working app. It has been tested on Windows, iOS, and Android. The animated image below shows it working on my Samsung Android phone. Yes, it does recognize hotdogs (and not hotdogs). The object tag it looks for is customizable so you can get it to look for other things instead, an apple, for example. Note that the graphics and UI faithfully reproduce those of the imaginary app from the HBO Silicon Valley TV show which was recorded ten years ago – we can do a lot better with today’s graphical capabilities! You will need to create an Amazon AWS account before you can do anything with the AWS SDK – their help explains the steps and Appercept’s AWS SDK fully integrates into the RAD Studio IDE so you can safely store your AWS credentials too so there’s no chance of accidentally revealing them to hackers.

Not a Hotdog real app running on Android on a Samsung Galaxy S22 Ultra

Where can I get Appercept’s AWS SDK for Delphi?

If you have the Enterprise or Architect version of RAD Studio 12.x or greater you can download it via the GetIt Package Manager.

Not a Hotdog How to Use AI Object Recognition in Your Apps how to find Appercept's AWS SDK

If you don’t have the Enterprise or Architect version you can either download a trial or, if you have the Professional version of Delphi or RAD Studio you can always get the Pro version of the AWS SDK directly from Appercept.

Not a Hotdog How to Use AI Object Recognition in Your Apps the Appercept home page

Is there a replay of the “Not a hotdog” webinar?

Yes, it’s here:

Where can I find the slides for the “Not a hotdog” webinar?

Here are the slides for the “Not a hotdog” webinar.

Where can I find the source code of the “Not a hotdog” app?

You can find the full source code here: https://github.com/checkdigits/new_seefood – make sure to read the notes. You will need to have the latest version of Appercept’s SDK installed and a recent version of RAD Studio with Delphi.


Not a Hotdog How to Use AI Object Recognition in Your Apps Delphi icon

If you want to try out the project and you don’t have a copy of the latest version of RAD Studio with Delphi, you can go to the products page and download a free fully working trial version.

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Ian is the Embarcadero Developer Advocate, a professional writer, presenter, and host. He is a prolific software developer, voice actor, designer and poet. Ian is British American, born in London, now living in Dallas, Texas. "I get up early every day and write code".

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES