You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

light-tagger

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

light-tagger

A package for tagging photo, all the tags will be combine to a sentence.

0.0.2
pipPyPI
Maintainers
1

light-tagger简单的打标工具,可以用于实现各类打标并合并成一句话。

目录

  • 仓库更新 Top News

  • 所需环境 Environment

  • 预测步骤 How2predict

  • 输入输出格式 Format

  • 参考资料 Reference

Top News

2023-08:仓库创建,更新wd14打标。

所需环境

按需要的requirements.txt配置即可


pip install -r requirements.txt

(Optional) 为了方便调用,可使用


pip install light-tagger

或者


git clone https://github.com/bubbliiiing/light-tagger.git

cd light-tagger

python setup.py install

快速安装。

然后,我们就可以在别的project里面使用light-tagger。

预测步骤

a、Demo

  • 下载完库后解压,运行predict.py即可。

python predict.py

b、在别的项目中使用light-tagger**。

  • 首先导入TaggerPredictor。

from light_tagger import TaggerPredictor

  • 根据模型名称创建模型。

# "SmilingWolf/wd-v1-4-convnext-tagger-v2"

# "SmilingWolf/wd-v1-4-convnextv2-tagger-v2.onnx"

# "SmilingWolf/wd-v1-4-swinv2-tagger-v2"

# "SmilingWolf/wd-v1-4-vit-tagger-v2"

model_name  = "SmilingWolf/wd-v1-4-convnext-tagger-v2"

model       = TaggerPredictor(model_name)

  • 传入图片并且进行预测

model(raw_image)

输入输出格式

a、inputs

当前必要输入为image。

无论是numpy格式还是PIL均可,使用RGB色域。

b、outputs

当前输出均为字典,通过不同的key调用不同的输出。

1.wd14

sentence代表打标结果汇总的一句话;

probs代表相对于总标签集合,每个标签的得分;

tags_list代表打标结果对应的list;


{

    "sentence": "general, sensitive, 1girl, long hair, smile, shirt, sitting, outdoors, barefoot, water, plaid, ocean, animal, beach, dog, leash, sand, plaid shirt",

    "tags_list": ['general', 'sensitive', '1girl', 'long hair', 'smile', 'shirt', 'sitting', 'outdoors', 'barefoot', 'water', 'plaid', 'ocean', 'animal', 'beach', 'dog', 'leash', 'sand', 'plaid shirt'], 

    "probs": [3.5740888e-01, 6.6963732e-01, 4.4209361e-03, ... 4.7683716e-06, 7.1525574e-07, 4.7683716e-07],

}

Reference

https://github.com/SmilingWolf/SW-CV-ModelZoo

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts