Skip to main content

MMKG Models

Project description

图像场景图生成使用说明

1. 算法描述

该算法用于图像场景图生成(SGG)。该算法基于PyTorch框架开发,输入一张图片,算法会检测图片中人和物的交互关系,输出图像场景图。

2. 依赖及安装

CUDA版本: 11.3 其他依赖库的安装命令如下:

conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge

可使用如下命令下载安装算法包:

pip install -U mmkg-sgg

3. 使用示例及运行参数说明

需要准备 pretrained_ckpt, labelmap_file, freq_prior 三个文件,可以通过 mmkg-sgg 上所提供的链接进行下载

from mmkg_vrd import SGG

sgg = SGG(
    pretrained_ckpt='custom_io/ckpt/RX152FPN_reldn_oi_best.pth',
    labelmap_file='custom_io/ji_vrd_labelmap.json', 
    freq_prior='custom_io/vrd_frequency_prior_include_background.npy', 
)

sgg.det_and_vis(
    img_file='custom_io/imgs/1024px-Gen_Robert_E_Lee_on_Traveler_at_Gettysburg_Pa.jpg',
    save_file='custom_io/out/1024px-Gen_Robert_E_Lee_on_Traveler_at_Gettysburg_Pa.reldn_relation.jpg')

print('all done')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmkg_sgg-0.2.0-cp37-cp37m-manylinux1_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.7m

File details

Details for the file mmkg_sgg-0.2.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mmkg_sgg-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 16f0d8661e30902bbd52857ecb6890a9fe87831ca7e8fd295c6ba1bcbf81bc0c
MD5 36fcd22a21035c8f234c20b164dece24
BLAKE2b-256 749fa3d0b16760455542684865c54c2b771dd29ebe3620c171285071d5b97082

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page