Message Boards Message Boards

Create a GUI for a classifier based on images?

Posted 5 years ago

I developed the following code which is suitable for cloud deployment. However, in order to avoid the problems of the cloud, I would like to create an user interface that runs in a Mathematica notebook. How could I do that? My code is as follows:

dobermann = 
  {-> "Dobermann", -> "Dobermann", -> "Dobermann", -> "Dobermann", -> "Dobermann"};
rottweiler = 
  {-> "Rottweiler", -> "Rottweiler", -> "Rottweiler", -> "Rottweiler", -> "Rottweiler"};
alano = 
  {-> "Alano", -> "Alano", -> "Alano", -> "Alano", -> "Alano"};
labrador = 
  {-> "Labrador", -> "Labrador", -> "Labrador", -> "Labrador", -> "Labrador" };
husky = 
  {-> "Husky", -> "Husky", -> "Husky", -> "Husky", -> "Husky" };

dogTypeSet = {dobermann, rottweiler, alano, labrador, husky};
class = Classify[Flatten[{dobermann, rottweiler, alano, labrador, husky}]];

CloudDeploy[
  FormPage[
    "image" -> "Image", 
    Column[{#image, "This is a " <> ToString[class[#image]]}] &, 
    AppearanceRules -> 
      <|"Title" -> "What dog is that?", 
        "Description" -> "Enter an image of a dog and I'll tell you what it is", 
        "SubmitLabel" -> "Classify"|>, PageTheme -> "Blue"], 
  Permissions -> "Public"]

The images must be inserted before the arrows. I removed them so as not to have problems in transcribing the code.

POSTED BY: Pasquale Rossi
5 Replies
Posted 5 years ago

A simpler way to import a user selected image file.

Button["Import image", 
 img = Import[SystemDialogInput["FileOpen", {"Image", {"Image" -> {"*.jpg", "*.png"}}}]], 
 Method -> "Queued"]

Pass img to ImageIdentify as described in the previous reply.

POSTED BY: Rohit Namjoshi

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

Please next time link your post to the duplicated one from MSE site.

You can simply restrict the identification of image to objects within the specified category:

ImageIdentify[dogImage , Entity["Species", "Infraspecies:CanisLupusFamiliaris"] ]
POSTED BY: Moderation Team
Posted 5 years ago

how could I implement this code that allows me to import an image:

Row[{FileNameSetter[Dynamic[file]], Dynamic[file]}]
Button["Load file", im = Import[file]]
Dynamic[im]
POSTED BY: Pasquale Rossi
Posted 5 years ago

If you are going to crosspost, please link them.

Why not use ImageIdentify?

POSTED BY: Rohit Namjoshi
Posted 5 years ago

how should i use ImageIdentify in this case?

POSTED BY: Pasquale Rossi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract