CowCowC jiechau commited on
Commit
a13fe5e
·
verified ·
0 Parent(s):

Duplicate from jiechau/adult-content-identify-image

Browse files

Co-authored-by: Jie-Chau Huang <[email protected]>

Files changed (6) hide show
  1. .gitattributes +35 -0
  2. README.md +47 -0
  3. config.json +33 -0
  4. model.onnx +3 -0
  5. model.safetensors +3 -0
  6. preprocessor_config.json +22 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ model-index:
3
+ - name: adult-content-classifier-image
4
+ results: []
5
+ pipeline_tag: image-classification
6
+ tags:
7
+ - adult-content-classifier-image
8
+ - classifier
9
+ - adult
10
+ - adult-content
11
+ - image-classifier
12
+ - image
13
+ - classifier
14
+ #widget:
15
+ # - text: "https://img.shopping.friday.tw/images/product/265/7951356/7951356_3_1.webp?172830"
16
+ # src: "https://img.shopping.friday.tw/images/product/265/7951356/7951356_3_1.webp?172830"
17
+ # example_title: "regular_一般商品圖片"
18
+ # - text: "https://img.shopping.friday.tw/images/product/259/7782883/7782883_3_1.webp?153546"
19
+ # src: "https://img.shopping.friday.tw/images/product/259/7782883/7782883_3_1.webp?153546"
20
+ # example_title: "adult_成人商品圖片"
21
+ ---
22
+
23
+ # adult-content-identify-image
24
+
25
+ (text version [here](https://huggingface.co/jiechau/adult-content-identify-text) 文字版本請參考 [這裡](https://huggingface.co/jiechau/adult-content-identify-text))
26
+
27
+
28
+ Determine whether online sales products are adult content. Input: image content, Output results: 0 Unknown, 1 Adult Content, 2 General Merchandise.
29
+
30
+ 判斷網路銷售商品是否屬於成人內容。輸入圖片內容,輸出結果: 0 未知, 1 成人內容, 2 一般商品。
31
+
32
+ # use transformers pipeline
33
+ ```python
34
+ from transformers import pipeline, AutoConfig
35
+ pipe = pipeline("image-classification", model="jiechau/adult-content-identify-image")
36
+ config = AutoConfig.from_pretrained("jiechau/adult-content-identify-image")
37
+ label2id = config.label2id
38
+ id2label = config.id2label
39
+
40
+ q = 'https://xxx.xxx.xxx/images/xxx/xxx.webp'
41
+ q = 'https://xxx.xxx.xxx/images/xxx/xxx.jpg'
42
+ result = pipe(q)
43
+ print(result)
44
+ print(label2id[result[0]['label']])
45
+ # [{'label': 'adult_成人商品', 'score': 0.7516837120056152}, {'label': 'regular_一般商品', 'score': 0.2475457787513733}, {'label': 'unknown', 'score': 0.0007705678581260145}]
46
+ # 1
47
+ ```
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "jiechau/adult-content-identify-image",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "unknown",
13
+ "1": "adult_\u6210\u4eba\u5546\u54c1",
14
+ "2": "regular_\u4e00\u822c\u5546\u54c1"
15
+ },
16
+ "image_size": 224,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3072,
19
+ "label2id": {
20
+ "adult_\u6210\u4eba\u5546\u54c1": 1,
21
+ "regular_\u4e00\u822c\u5546\u54c1": 2,
22
+ "unknown": 0
23
+ },
24
+ "layer_norm_eps": 1e-12,
25
+ "model_type": "vit",
26
+ "num_attention_heads": 12,
27
+ "num_channels": 3,
28
+ "num_hidden_layers": 12,
29
+ "patch_size": 16,
30
+ "problem_type": "single_label_classification",
31
+ "qkv_bias": true,
32
+ "transformers_version": "4.37.1"
33
+ }
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:737d8bf97854d17fe1e18e78c001892d3ad744c740fd131c10f6741674a5a62b
3
+ size 343466972
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dcc50584b862766ab095521bb455a249d63b4a7f16e93ee9d66c948b9d0da4c
3
+ size 343227052
preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_rescale": true,
4
+ "do_resize": true,
5
+ "image_mean": [
6
+ 0.5,
7
+ 0.5,
8
+ 0.5
9
+ ],
10
+ "image_processor_type": "ViTFeatureExtractor",
11
+ "image_std": [
12
+ 0.5,
13
+ 0.5,
14
+ 0.5
15
+ ],
16
+ "resample": 2,
17
+ "rescale_factor": 0.00392156862745098,
18
+ "size": {
19
+ "height": 224,
20
+ "width": 224
21
+ }
22
+ }