Message Boards Message Boards

Let's play with ImageIdentify

Posted 8 years ago
9 Replies

enter image description here - you earned "Featured Contributor" badge, congratulations !

This is a great post and it has been selected for the curated Staff Picks group. Your profile is now distinguished by a "Featured Contributor" badge and displayed on the "Featured Contributor" board.

POSTED BY: Moderation Team

Thanks to everyone for the comments.


@Carlo : Yes, you are right. My way of dealing with the URL was rather basic and certainly not bugproof. I have now improved the code with URLBuild:

ImgPlay2[x_?StringQ] := Module[{a, a2, b},
  Sow[x, "name"]; 
  a = Import[
    URLBuild[{"http://images.google.com/search"}, {"q" -> x}], 
    "Images"]; 
  If[Length[a] > 0, a2 = RandomChoice[a], 
   a2 = First@
     Import["http://images.google.com/search?q=mickey+mouse", 
      "Images"]]; Sow[a2, "Image"]; 
  b = CommonName@ImageIdentify[a2, SpecificityGoal -> "High"]; b]

@ Arnoud : From the list of entities you obtain, applying the ImgPlay function, and using ImageCollage, I get this picture of your office (I'm sure you can recognize it :-) ):
Arnoud's office :)

HI,

I've noticed you're using StringReplace to remove spaces from your URL. You might want to consider using something like URLEncode to escape the other non-safe characters.

In[7]:= URLEncode["èü/:%"]

Out[7]= "%C3%A8%C3%BC%2F%3A%25"

Or even URLBuild to directly construct the whole URL.

In[5]:= URLBuild[{"https://images.google.com/search"}, { 
  "q" -> "foo bar"}]

Out[5]= "https://images.google.com/search?q=foo+bar"
POSTED BY: Carlo Barbieri

Nice!

Another fun one to play around with (requires a webcam):

cc = {};
Dynamic[{c = CurrentImage[], cc = Union[cc, {ImageIdentify[c]}]}]

Randomly pointing my webcam in different directions gives an array of identified entities (some quite reasonable and others less so):

enter image description here

POSTED BY: Arnoud Buzing

Wow amazing! nice succinct code. I'm seriously wondering where you are, the combination of oil-refinery, laser printer, cooling tower, and plane seat makes for an interesting scene!

POSTED BY: Sander Huisman

My office looks out on a McDonalds restaurant. Which would explain "oil refinery" and "industrial plant" ...

POSTED BY: Arnoud Buzing

Exercise: figure out what fraction of buildings in the US don't overlook a McDonalds "restaurant".

Bonus points for using height of buildings and GeoVisibleRegion.

POSTED BY: Carlo Barbieri

Hahaha! Funny but kinda sad.

POSTED BY: Sander Huisman

I never thought about using Sow inside a function and the Reap 'outside' it.... nice...

POSTED BY: Sander Huisman
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