gigasquid commented on a change in pull request #14567: [Clojure] enhance draw
bounding box
URL: https://github.com/apache/incubator-mxnet/pull/14567#discussion_r274173991
##########
File path:
contrib/clojure-package/examples/infer/objectdetector/src/infer/objectdetector_example.clj
##########
@@ -54,27 +56,30 @@
:validate [check-valid-dir "Input directory not found"]]
["-h" "--help"]])
-(defn result->map [{:keys [class prob x-min y-min x-max y-max]}]
- (hash-map
- :label class
- :confidence (int (* 100 prob))
- :top-left [x-min y-min]
- :bottom-right [x-max y-max]))
-
-(defn print-results [results]
- (doseq [_r results]
- (println (format "Class: %s Confidence=%s Coords=(%s, %s)"
- (_r :label)
- (_r :confidence)
- (_r :top-left)
- (_r :bottom-right)))))
-
(defn process-results [images results output-dir]
- (dotimes [i (count images)]
- (let [image (nth images i) _results (map result->map (nth results i))]
- (println "processing: " image)
- (print-results _results)
- (draw/draw-bounds image _results output-dir))))
+ (mapv (fn [image-path result]
Review comment:
Thanks - I'll refactor it so the side effect is more clear with a
`process-result!` and `doall`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services