 
 (defn create-dataset-from-folder
   "Turns a folder of folders of png images into a dataset (a sequence of maps)."
-  [folder-name class-mapping & {:keys [image-aug-fn datatype]
-                                :or {datatype :float}}]
+  [folder-name class-mapping & {:keys [image-aug-fn datatype colorspace]
+                                :or {datatype :float
+                                     colorspace :gray}}]
   (println "Building dataset from folder:" folder-name)
   (->> folder-name
        (io/as-file)

       (map (partial file->observation
                     class-mapping
                     image-aug-fn
                     datatype))
       (remove nil?)))


(defn- image->observation-data
  "Create an observation from input."
  [image datatype colorspace image-aug-fn]
  (patch/image->patch (if image-aug-fn
                        (image-aug-fn image)
                        image)
                      :datatype datatype
                      :colorspace colorspace))


(defn- file->observation
  "Given a file, returns an observation map (an element of a dataset)."
  [{:keys [class-name->index]} image-aug-fn datatype colorspace ^File file]
  (try
    {:data (image->observation-data (i/load-image file) datatype colorspace image-aug-fn)
     :labels (util/idx->one-hot (class-name->index (.. file getParentFile getName))
                                (count (keys class-name->index)))}
    (catch Throwable _
