franciscomj0901 commited on
Commit
8309f6f
·
verified ·
1 Parent(s): c4016a2

initial upload

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. README.md +58 -3
  3. config.json +52 -0
  4. model.safetensors +3 -0
  5. preprocessor_config.json +26 -0
  6. sample_image.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
36
+ sample_image.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,58 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: mit
4
+ language:
5
+ - en
6
+ pipeline_tag: object-detection
7
+ base_model:
8
+ - hustvl/yolos-tiny
9
+ tags:
10
+ - object-detection
11
+ - fashion
12
+ - search
13
+ ---
14
+ This model is fine-tuned version of hustvl/yolos-tiny.
15
+
16
+ You can find details of model in this github repo -> [fashion-visual-search](https://github.com/yainage90/fashion-visual-search)
17
+
18
+ And you can find fashion image feature extractor model -> [yainage90/fashion-image-feature-extractor](https://huggingface.co/yainage90/fashion-image-feature-extractor)
19
+
20
+ This model was trained using a combination of two datasets: [modanet](https://github.com/eBay/modanet) and [fashionpedia](https://fashionpedia.github.io/home/)
21
+
22
+ The labels are ['bag', 'bottom', 'dress', 'hat', 'shoes', 'outer', 'top']
23
+
24
+ In the 96th epoch out of total of 100 epochs, the best score was achieved with mAP 0.697400.
25
+
26
+ ``` python
27
+ from PIL import Image
28
+ import torch
29
+ from transformers import YolosImageProcessor, YolosForObjectDetection
30
+
31
+ device = 'cpu'
32
+ if torch.cuda.is_available():
33
+ device = torch.device('cuda')
34
+ elif torch.backends.mps.is_available():
35
+ device = torch.device('mps')
36
+
37
+ ckpt = 'yainage90/fashion-object-detection-yolos-tiny'
38
+ image_processor = YolosImageProcessor.from_pretrained(ckpt)
39
+ model = YolosForObjectDetection.from_pretrained(ckpt).to(device)
40
+
41
+ image = Image.open('<path/to/image>').convert('RGB')
42
+
43
+ with torch.no_grad():
44
+ inputs = image_processor(images=[image], return_tensors="pt")
45
+ outputs = model(**inputs.to(device))
46
+ target_sizes = torch.tensor([[image.size[1], image.size[0]]])
47
+ results = image_processor.post_process_object_detection(outputs, threshold=0.85, target_sizes=target_sizes)[0]
48
+
49
+ items = []
50
+ for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
51
+ score = score.item()
52
+ label = label.item()
53
+ box = [i.item() for i in box]
54
+ print(f"{model.config.id2label[label]}: {round(score, 3)} at {box}")
55
+ items.append((score, label, box))
56
+ ```
57
+
58
+ ![sample_image](sample_image.png)
config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "hustvl/yolos-tiny",
3
+ "architectures": [
4
+ "YolosForObjectDetection"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "auxiliary_loss": false,
8
+ "bbox_cost": 5,
9
+ "bbox_loss_coefficient": 5,
10
+ "class_cost": 1,
11
+ "eos_coefficient": 0.1,
12
+ "giou_cost": 2,
13
+ "giou_loss_coefficient": 2,
14
+ "hidden_act": "gelu",
15
+ "hidden_dropout_prob": 0.0,
16
+ "hidden_size": 192,
17
+ "id2label": {
18
+ "0": "bag",
19
+ "1": "bottom",
20
+ "2": "dress",
21
+ "3": "hat",
22
+ "4": "outer",
23
+ "5": "shoes",
24
+ "6": "top"
25
+ },
26
+ "image_size": [
27
+ 800,
28
+ 1333
29
+ ],
30
+ "initializer_range": 0.02,
31
+ "intermediate_size": 768,
32
+ "label2id": {
33
+ "bag": 0,
34
+ "bottom": 1,
35
+ "dress": 2,
36
+ "hat": 3,
37
+ "outer": 4,
38
+ "shoes": 5,
39
+ "top": 6
40
+ },
41
+ "layer_norm_eps": 1e-12,
42
+ "model_type": "yolos",
43
+ "num_attention_heads": 3,
44
+ "num_channels": 3,
45
+ "num_detection_tokens": 100,
46
+ "num_hidden_layers": 12,
47
+ "patch_size": 16,
48
+ "qkv_bias": true,
49
+ "torch_dtype": "float32",
50
+ "transformers_version": "4.48.0",
51
+ "use_mid_position_embeddings": false
52
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4638099a1ed79c362037b94f1648a5cf1b141feab309796e54f33f0d74c66bc
3
+ size 25914032
preprocessor_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_annotations": true,
3
+ "do_normalize": true,
4
+ "do_pad": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "format": "coco_detection",
8
+ "image_mean": [
9
+ 0.485,
10
+ 0.456,
11
+ 0.406
12
+ ],
13
+ "image_processor_type": "YolosImageProcessor",
14
+ "image_std": [
15
+ 0.229,
16
+ 0.224,
17
+ 0.225
18
+ ],
19
+ "pad_size": null,
20
+ "resample": 2,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "longest_edge": 1333,
24
+ "shortest_edge": 512
25
+ }
26
+ }
sample_image.png ADDED

Git LFS Details

  • SHA256: f58eb91b8ba3a0a7f92f6a80feaebff0562cdf96a6a97a0fdab10ae3e65351f8
  • Pointer size: 131 Bytes
  • Size of remote file: 621 kB