feat: 推論エンジンを nsfwjs + tfjs-node から ONNX Runtime に移行#11
Merged
Conversation
- onnxruntime-node + pngjs に依存を置換し、systeminformation を削除 - classifier.ts を ONNX Runtime (InferenceSession) ベースに全面書き換え - 入力を 299×299 PNG のみに限定(Misskey 本体が正規化済み PNG を送る契約) - computeIsSupportedCpu を削除(ONNX Runtime は x64/arm64 両対応) - Dockerfile から tfjs-node 用ビルドツール (python3/make/g++) を除去 - types.ts から nsfwjs/core の PredictionType 依存を削除
samunohito
reviewed
Jun 25, 2026
samunohito
left a comment
Member
There was a problem hiding this comment.
prありがとうございます。
確認させていただいたところ、気になる点がありましたのでコメントします。
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
推論エンジンを nsfwjs + tfjs-node から ONNX Runtime に移行
SENSITIVE_DETECTOR_THREADSで指定可能SENSITIVE_DETECTOR_THREADS=0とすることで全コアを使用可能Why
Additional info (optional)
ベンチマーク
環境
SENSITIVE_DETECTOR_THREADS=1(1スレッド推論)イメージサイズ比較
精度比較
レイテンシ比較 (ms)
リソース使用量
SENSITIVE_DETECTOR_THREADS=1) で TF.js より高速かつ CPU 使用率は半分以下に