Skip to content

API Question: Class Mapping and execute/run return value #182

@hellonico

Description

@hellonico

Supposing I train a network with:

(classification/perform-experiment
  (initial-description image-size image-size num-classes)
                                 train-ds
                                 test-ds
                                 observation->image
                                 class-mapping
                                 {})

And do a guess on a new observation (after loading the nippy file), with

(def nippy
  (util/read-nippy-file "trained-network.nippy"))
(execute/run nippy (into-array (image-file->observation "cat.png")))

The return of execute/run is a number, and the result needs to be converted to the class again to find out the real guess. Here, if I get 0, I need to execute an extra function like:

(defn index->class-name[n]
  (nth ["cat" "dog"] n))

to get the expected value "cat" from the returned result of : 0.

But I thought that was the reason for the parameter class-mapping passed to initial-description during the training step ?

  (def class-mapping
    {:class-name->index (zipmap ["cat" "dog"] (range))
     :index->class-name (zipmap (range) ["cat" "dog"])})

Shouldn't the network in the nippy file serialize the class-mapping and be able to return the decoded value ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions