FreeAnchor
FreeAnchor
vision
detection
开发者: MegEngine Team
FreeAnchor (COCO2017预训练权重)
from megengine import hub
model = hub.load(
    "megengine/models",
    "freeanchor_res50_coco_3x_800size",
    pretrained=True,
    use_cache=False,
)
model.eval()

models_api = hub.import_module(
    "megengine/models",
    git_host="github.com",
)

所有预训练模型希望数据被正确预处理。 模型要求输入BGR的图片, 同时需要等比例缩放到:短边和长边分别不超过800/1333 最后做归一化处理 (均值为: [103.530, 116.280, 123.675], 标准差为: [57.375, 57.120, 58.395])。

下面是一段处理一张图片的样例代码。

# Download an example image from the megengine data website
import urllib
url, filename = ("https://data.megengine.org.cn/images/cat.jpg", "cat.jpg")
try: urllib.URLopener().retrieve(url, filename)
except: urllib.request.urlretrieve(url, filename)

# Read and pre-process the image
import cv2
import megengine as mge

image = cv2.imread("cat.jpg")
data, im_info = models_api.DetEvaluator.process_inputs(image, 800, 1333)
predictions = model(image=mge.tensor(data), im_info=mge.tensor(im_info))
print(predictions)

模型描述

目前我们提供了在COCO2017数据集上预训练的FreeAnchor模型, 性能如下:

model mAP<br>@5-95
freeanchor-res18-coco-3x-800size 38.1
freeanchor-res34-coco-3x-800size 41.1
freeanchor-res50-coco-3x-800size 42.1
freeanchor-res101-coco-3x-800size 43.9
freeanchor-resx101-coco-2x-800size 44.9

参考文献