# Importing multiple images for machine learning classification

I want to create a ML classifier using images just like this example.

I have two classes of images in two different folders. Is there an easier way to import all images from both folders rather than inserting picture by picture?

• something like Import[#] & /@ FileNames["folder/*.jpg"] is what you want. Mathematica has about 3 gigabytes of documentation. – acl Aug 22 '14 at 18:40
• You can also use wildcards directly in Import – mfvonh Aug 22 '14 at 21:20

Classify actually supports a nice syntax for this:

Classify[<|"class1" -> Import["class1/*"], "class2" -> Import["class2/*"]|>]


Yes, in order to create your list of images you can use the following piece of code:

Join[

• That Thread @ Rule stuff is totally unnecessary. Look at the third usage of Classify – Taliesin Beynon Sep 24 '14 at 5:30