Skip to content

Instantly share code, notes, and snippets.

View cnuernber's full-sized avatar

Chris Nuernberger cnuernber

View GitHub Profile
@cnuernber
cnuernber / image-code.clj
Last active April 13, 2016 18:15
Image md5 algorithm with examples
(defn md5 [str]
(let [md (java.security.MessageDigest/getInstance "MD5")
bytes (.digest md (.getBytes str))
bi (BigInteger. 1 bytes)]
(.toString bi 16)))
(defn calculate-visual-id
[images]
(md5 (clojure.string/lower-case (clojure.string/join (sort (distinct images))))))
@cnuernber
cnuernber / example.clj
Created December 26, 2017 22:17
print-layer-summary
cortex.verify.nn.train> (-> [(layers/input input-w input-h 1 :id :data)
(layers/convolutional 5 0 1 20)
(layers/max-pooling 2 0 2)
(layers/relu)
(layers/convolutional 5 0 1 50)
(layers/max-pooling 2 0 2)
(layers/batch-normalization)
(layers/linear 1000)
(layers/relu :center-loss {:label-indexes {:stream :labels}
:label-inverse-counts {:stream :labels}
@cnuernber
cnuernber / traversal-example.clj
Created December 26, 2017 22:24
Optimization to use buffer pools instead of a buffer per forward step
cortex.verify.nn.train> (-> [(layers/input input-w input-h 1 :id :data)
(layers/convolutional 5 0 1 20)
(layers/max-pooling 2 0 2)
(layers/relu)
(layers/convolutional 5 0 1 50)
(layers/max-pooling 2 0 2)
(layers/batch-normalization :mode :spatial)
(layers/linear 1000)
(layers/relu :center-loss {:label-indexes {:stream :labels}
:label-inverse-counts {:stream :labels}
// Targeted by JavaCPP version 1.4: DO NOT EDIT THIS FILE
package tvm_clj.tvm;
import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;
public class runtime extends tvm_clj.tvm.presets.runtime {
static { Loader.load(); }
fsof.event-analysis.verification> (->> (sql/event-account-videos 6703)
(group-by :proxy-url)
(map (fn [[url acc-vids]]
[url (count acc-vids)])))
(["s3://fsof-video-corpus/events/6703/proxies/902161.mp4" 8]
["s3://fsof-video-corpus/events/6703/proxies/900074.mp4" 1]
["s3://fsof-video-corpus/events/6703/proxies/902301.mp4" 1]
["s3://fsof-video-corpus/events/6703/proxies/902495.mp4" 1]
["s3://fsof-video-corpus/events/6703/proxies/902604.mp4" 1]
["s3://fsof-video-corpus/events/6703/proxies/902718.mp4" 5]
```clojure
(summarize-joined-videos joined-vids acc-vids appearance-counts)
{:num-account-videos 469,
:summary [{:analysis-type :dlib-faces-only,
:found-appearance-stats {:initial-appearance-depths {:avg 10.67945205479452,
:max 96.0,
:min 0.0},
:last-appearance-depths {:avg 27.72602739726027,
:max 99.0,
:min 0.0},
{:body {:summary {:num-account-videos 466,
:num-checkins 563,
:summaries {:appearance-system {:dlib-correlation {:match-depth {:avg 17.63100137174211,
:max 99.0,
:min 0.0},
:match-score {:avg 0.867808825869121,
:max 1.1787557637974377,
:min 0.373683437641763},
:matching-count 729,
:num-found-videos 367,
@cnuernber
cnuernber / comparison.clj
Created June 30, 2018 23:08
full results
{:num-account-videos 466,
:num-checkins 563,
:summaries {:appearance-system {:dlib-correlation {:match-depth {:max 99.0,
:mean 17.63100137174211,
:median 6,
:min 0.0,
:variance 559.7853562760971},
:match-score {:max 1.1787557637974377,
:mean 0.867808825869121,
:median 0.8816001907900003,
Trained: 19 0.00 0.20 0.00 6 1.00 1.00 45 [0.001294] <- new best
Trained: 18 0.00 0.20 0.00 5 1.00 1.00 45 [0.001312]
Trained: 17 0.10 0.00 0.30 7 1.20 0.70 5 [0.250000]
Trained: 16 0.30 1.00 0.10 4 0.90 0.70 45 [0.001531]
Trained: 15 0.00 0.00 0.00 1 0.70 0.70 5 [0.250000]
Trained: 14 0.00 0.80 0.20 9 0.80 1.00 45 [0.001390]
Trained: 13 0.00 0.00 0.30 2 0.80 0.90 45 [0.250000]
Trained: 12 0.30 0.80 0.00 9 0.90 1.00 35 [0.001526]
Trained: 11 0.20 1.00 0.00 1 1.30 1.00 45 [0.001132] <- new best
Trained: 10 0.10 1.00 0.00 7 0.70 0.90 45 [0.001388]
({:fsof.data.model.video-set/face-count 2088414,
:fsof.data.model.video-set/name "min-face-size-40",
:fsof.data.model.video-set/uuid #uuid "5b3f93da-f9a4-4431-bbb5-37cea2df6c3c"}
{:fsof.data.model.video-set/face-count 1287144,
:fsof.data.model.video-set/name "min-face-size-80",
:fsof.data.model.video-set/uuid #uuid "5b3f93eb-7cfd-411b-8caa-f903733e76b9"}
{:fsof.data.model.video-set/face-count 739941,
:fsof.data.model.video-set/name "min-face-size-160",
:fsof.data.model.video-set/uuid #uuid "5b3f93fb-ab73-42f2-b673-45f45c213847"})