narugo1992 commited on
Commit
eb90583
·
verified ·
1 Parent(s): 65a6a2e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -74
README.md CHANGED
@@ -9,6 +9,7 @@ tags:
9
  - danbooru
10
  - deep-learning
11
  - computer-vision
 
12
 
13
  # ML-Danbooru ONNX Models
14
 
@@ -51,46 +52,6 @@ tags_custom = get_mldanbooru_tags(
51
  print(tags_custom)
52
  ```
53
 
54
- ### Advanced Usage with Model Selection
55
-
56
- ```python
57
- from huggingface_hub import hf_hub_download
58
- from imgutils.utils import open_onnx_model
59
- from PIL import Image
60
- import numpy as np
61
-
62
- # Load a specific model from this repository
63
- model_path = hf_hub_download('deepghs/ml-danbooru-onnx', 'ml_caformer_m36_dec-5-97527.onnx')
64
- model = open_onnx_model(model_path)
65
-
66
- # Manual preprocessing and inference
67
- def preprocess_image(image_path, size=448):
68
- image = Image.open(image_path).convert('RGB')
69
- # Resize with alignment for optimal performance
70
- min_edge = min(image.size)
71
- target_size = (
72
- int(image.size[0] / min_edge * size),
73
- int(image.size[1] / min_edge * size),
74
- )
75
- target_size = (
76
- (target_size[0] // 4) * 4,
77
- (target_size[1] // 4) * 4,
78
- )
79
- image = image.resize(target_size, resample=Image.BILINEAR)
80
-
81
- # Convert to tensor
82
- img_array = np.array(image, dtype=np.float32).transpose(2, 0, 1) / 255.0
83
- return img_array.reshape(1, *img_array.shape)
84
-
85
- # Run inference
86
- input_tensor = preprocess_image('your_image.jpg')
87
- output = model.run(['output'], {'input': input_tensor})[0]
88
- probabilities = 1 / (1 + np.exp(-output)).reshape(-1)
89
-
90
- # Process results (you would need to load the tag labels)
91
- # tags = process_probabilities(probabilities, threshold=0.7)
92
- ```
93
-
94
  ## Model Variants
95
 
96
  This repository contains multiple ML-Danbooru model variants:
@@ -123,40 +84,6 @@ The repository includes comprehensive tag information:
123
  - **Architecture**: Caformer-M36 and TResnet variants
124
  - **Format**: ONNX for optimized inference
125
 
126
- ## Original Content
127
-
128
- ### Tag Database Structure
129
-
130
- The repository includes a comprehensive tag database with the following structure:
131
-
132
- ```json
133
- // Sample from classes.json (simplified tags)
134
- [
135
- "1girl",
136
- "bangs",
137
- "blunt_bangs",
138
- "brown_hair",
139
- "hair_bun",
140
- "hime_cut",
141
- "long_hair",
142
- "mask",
143
- "ribbon",
144
- "solo",
145
- "yellow_eyes",
146
- // ... 1,527 tags total
147
- ]
148
- ```
149
-
150
- ```csv
151
- # Sample from tags.csv
152
- tag,root,pos,count
153
- 1girl,girl,NOUN,4317542
154
- bangs,bang,NOUN,1576060
155
- blunt_bangs,bang,NOUN,178797
156
- brown_hair,hair,NOUN,1092727
157
- hair_bun,bun,NOUN,157335
158
- ```
159
-
160
  ### Model Architecture Details
161
 
162
  The ML-Danbooru models utilize modern transformer-based architectures:
 
9
  - danbooru
10
  - deep-learning
11
  - computer-vision
12
+ ---
13
 
14
  # ML-Danbooru ONNX Models
15
 
 
52
  print(tags_custom)
53
  ```
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ## Model Variants
56
 
57
  This repository contains multiple ML-Danbooru model variants:
 
84
  - **Architecture**: Caformer-M36 and TResnet variants
85
  - **Format**: ONNX for optimized inference
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  ### Model Architecture Details
88
 
89
  The ML-Danbooru models utilize modern transformer-based architectures: