
カメラに写っている人の性別と年齢を推定したくなり、見つけたライブラリ「face-api.js」を使って実装「age-detector」

「code4fukui/age-detector」
GitHubでのオープンソース。face-api.jsは、ESモジュール化しているので、上記ページをimportする形でも使えます。


「code4fukui/age-detector」
GitHubでのオープンソース。face-api.jsは、ESモジュール化しているので、上記ページをimportする形でも使えます。

ベースディレクトリを指定してインスタンスを作成、saveとloadの非同期メソッドを呼び出すだけ!
import { FileStorage } from "https://code4fukui.github.io/FileStorage/FileStorage.js"; const bin = new TextEncoder().encode("abc"); const fs = new FileStorage("data"); const path = "data/test/abc.txt"; await fs.save(path, bin); const bin2 = await fs.load(path);
インターフェイスを合わせれば、将来DB化したり、分散管理したりもできます。

「EXT」
ファイル名から拡張子を取り出したり再設定するライブラリです。
使い方
import { EXT } from "https://code4fukui.github.io/EXT/EXT.js"; const ext = EXT.get("a.jpg"); console.log(ext); // "jpg" const fn2 = EXT.set("a.jpg", "png"); console.log(fn2); // "a.png"