Message Boards Message Boards

GROUPS:

Create a GUI for a classifier based on images?

Posted 4 months ago
662 Views
|
5 Replies
|
2 Total Likes
|

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.

5 Replies
Posted 4 months ago

If you are going to crosspost, please link them.

Why not use ImageIdentify?

Posted 4 months ago

how should i use ImageIdentify in this case?

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 4 months 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 4 months 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.

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