Skip to main content

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

Project description

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


目录

  1. 仓库更新 Top News

  2. 所需环境 Environment

  3. 预测步骤 How2predict

  4. 输入输出格式 Format

  5. 参考资料 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

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

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

  1. 首先导入TaggerPredictor。
from light_tagger import TaggerPredictor
  1. 根据模型名称创建模型。

# "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)

  1. 传入图片并且进行预测

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

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.

light_tagger-0.0.2-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file light_tagger-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: light_tagger-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for light_tagger-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2040b24acf653c402039967938b91b348cd07943e117fa2d035b52c554dcb39
MD5 c579e5a4fb9fdd738ca38cb794012602
BLAKE2b-256 14dc22763e2095f62ace46dece44feaa7436ee9b948868d5b53ea98f1b3150d0

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