FCOS
FCOSは定義済みのアンカーボックス群に依存せず、ピクセル単位で物体を検出します。特徴マップ上の各位置でボックスとcenternessスコアを予測します。LibreYOLOはtorchvisionの実装を物体検出向けに移植しています。
- タスク
- detection
- サイズ
- r50 at 800 px
- インストール
pip install libreyolo- サポートティア
- 推論のみ、v以降。推論、検証、エクスポートのみです。学習機能は対象外です。
- ライセンス
- コード:BSD-3-Clause、重み:BSD-3-Clause。商用利用
インストール
FCOSに任意の追加パッケージは必要ありません。インポートするものはすべて基本インストールに含まれます。
pip install libreyolo推論
重みは初回使用時にHugging Faceからダウンロードされ、ローカルにキャッシュされます。
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreFCOSr50.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes: print(box.cls, box.conf, box.xyxy)libreyolo predict model=LibreFCOSr50.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True返されるResultsオブジェクトはすべてのファミリーで共通のため、別の検出器への切り替えは
1行の変更だけで済みます。しきい値引数を指定せずにモデルを呼び出すと、FCOS独自の公開済み
デフォルト値conf=0.2、iou=0.6、max_det=100が適用されます。上書きするには3つの
いずれかを渡します。FCOSはピクセル単位の推論結果に対する最終NMS処理を維持します。
入力ソース、ストリーミング、結果の処理については推論を参照してください。
バリアント
サイズはfeature pyramidを持つResNet-50の1種類で、このファミリーが認識する唯一の バリアントです。
検証
val()は、学習に使った形式の任意のデータセットに対して測定した適合率、再現率、mAP 50、
mAP 50-95を含むmetrics/キーの辞書を返します。
from libreyolo import LibreYOLO model = LibreYOLO("LibreFCOSr50.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])libreyolo val model=LibreFCOSr50.pt data=my-dataset.yamlエクスポート
| タスク | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Detection | Detection to ONNX:対応 | Detection to TorchScript:対応 | Detection to ExecuTorch:非対応 | Detection to TensorRT:非対応 | Detection to OpenVINO:対応 | Detection to Paddle:非対応 | Detection to MNN:非対応 | Detection to RKNN:非対応 | Detection to ncnn:非対応 | Detection to TFLite:非対応 | Detection to CoreML:非対応 | Detection to Core AI:非対応 |
FCOSはONNX、TorchScript、OpenVINOへエクスポートできます。FCOSはグラフ実行前に入力ソースの
アスペクト比を維持するため、LibreYOLOは渡された値にかかわらずONNXとOpenVINOの経路で
dynamic=Trueを強制します。これにより、paddingされた入力形状でもグラフが有効に保たれます。
エクスポートした.onnxファイルは、ファイル接尾辞に基づいてLibreYOLO()から再読み込みされ、
同じResultsを返します。
from libreyolo import LibreYOLO model = LibreYOLO("LibreFCOSr50.pt")model.export(format="onnx", imgsz=800)model.export(format="torchscript", imgsz=800)libreyolo export model=LibreFCOSr50.pt format=onnx imgsz=800from libreyolo import LibreYOLO, SAMPLE_IMAGE # ファクトリがファイル接尾辞で振り分けるため、エクスポートした成果物も# 通常のチェックポイントと同様に読み込まれ、同じResultsオブジェクトを返すmodel = LibreYOLO("LibreFCOSr50.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)チェックポイント
このファミリーで公開されているすべての重みファイルです。
| ファイル | 入力(px) | 重みのライセンス |
|---|---|---|
| Detection | ||
| LibreFCOSr50.pt | 800 | bsd-3-clause |
上記のすべてのファイルは現在LibreYOLO orgにあり、初回使用時にダウンロードされます。
ライセンス
ダウンロードする特定の重みについて、Hugging Faceリポジトリのライセンスを確認してください。LibreYOLO orgの各チェックポイントにはライセンスが付与されており、同じファミリー内でも常に同一とは限りません。そのリポジトリが正式な情報源です。以下の概要は、このページを最後に検証した時点で適用されていた内容を示します。
これは関連するライセンスの説明であり、法的助言ではありません。商用上重要な場合は、自分でライセンスを読み、専門家の助言を受けてください。
- 原著作物
- FCOS, PyTorch
- アップストリームのライセンス
- BSD-3-Clause
- アップストリームのソース
- github.com/pytorch/vision
- LibreYOLOのコード
- MIT
- 重み
- BSD-3-Clause、huggingface.co/LibreYOLOで再公開
- 解釈
- BSD-3-Clause is a permissive license, so this code can be used in commercial and closed-source products with no obligation on your own application code. It asks only that you keep the copyright notice and disclaimer with any copy you redistribute, and it carries no patent grant. The published checkpoint used for parity testing is not distributed in the LibreYOLO source tree: torchvision's own documentation notes that a pretrained model's terms may depend on its training data, so the Hugging Face mirror ships the BSD text on that implied basis and repeats the caveat rather than issuing an explicit checkpoint-specific grant.
引用
@inproceedings{tian2019fcos,
title = {{FCOS}: Fully Convolutional One-Stage Object Detection},
author = {Tian, Zhi and Shen, Chunhua and Chen, Hao and He, Tong},
booktitle = {Proc. Int. Conf. Computer Vision (ICCV)},
year = {2019}
}
@article{tian2021fcos,
title = {{FCOS}: A Simple and Strong Anchor-free Object Detector},
author = {Tian, Zhi and Shen, Chunhua and Chen, Hao and He, Tong},
booktitle = {IEEE T. Pattern Analysis and Machine Intelligence (TPAMI)},
year = {2021}
}著者によるgithub.com/tianzhi0549/FCOS#citationsの引用ブロックからコピーしています。