jun710 commited on
Commit
2228b39
·
verified ·
1 Parent(s): 05f0373

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +53 -10
README.md CHANGED
@@ -4,36 +4,79 @@ tags:
4
  - tattoo-segmentation
5
  - image-segmentation
6
  - pytorch
 
 
7
  ---
8
 
9
- # Deep Tattoo Segmentation
10
 
11
- 2-Stage tattoo extraction model using Attention U-Net.
12
 
13
  ## Models
14
 
15
- - `best_model_pytorch.pth`: Stage 1 - Skin detection (Val Dice: 93.08%)
16
- - `tattoo_stage2_best.pth`: Stage 2 v1 - Tattoo extraction (Val Dice: 75.77%)
17
- - `tattoo_stage2_v2_best.pth`: Stage 2 v2 - Fine-line tattoo detection (Val Dice: 73.63%)
18
- - `tattoo_final_best.pth`: Final model trained on 9,000 images (Best checkpoint)
19
- - `tattoo_final_last.pth`: Final model trained on 9,000 images (Last checkpoint)
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## Usage
22
 
23
  ```python
24
  import torch
 
 
25
  from huggingface_hub import hf_hub_download
26
 
27
- # Download model
28
  model_path = hf_hub_download(
29
  repo_id="jun710/deep-tattoo",
30
- filename="best_model_pytorch.pth"
31
  )
32
 
33
  # Load model
34
- model = torch.load(model_path, map_location='cpu')
 
 
 
 
 
 
35
  ```
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ## Repository
38
 
39
  https://github.com/enjius/deep-tattoo
 
4
  - tattoo-segmentation
5
  - image-segmentation
6
  - pytorch
7
+ - unet
8
+ - edge-detection
9
  ---
10
 
11
+ # Deep Tattoo Segmentation v5
12
 
13
+ Edge-Aware Attention U-Net for precise tattoo extraction with transparent background.
14
 
15
  ## Models
16
 
17
+ - `edge_aware_v3_clahe_best.pth`: **v5 Model** - Best performance (Val Dice: **90.50%**)
18
+ - Edge-Aware Attention U-Net architecture
19
+ - CLAHE preprocessing for lighting invariance
20
+ - Trained on 24 manual labels + 165 auto-generated masks
21
+ - Test-Time Augmentation (TTA) support
22
+
23
+ - `edge_aware_improved_best.pth`: Base Model (Val Dice: 79.17%)
24
+ - Foundation model before hybrid training
25
+
26
+ ## Key Features
27
+
28
+ - **High Accuracy**: 90.50% Dice coefficient on validation set
29
+ - **Edge Detection**: Specialized edge-aware attention mechanism
30
+ - **Lighting Invariant**: CLAHE preprocessing handles various lighting conditions
31
+ - **Transparent Output**: Extracts tattoos with alpha channel for transparent background
32
+ - **Production Ready**: Optimized for inference with TTA
33
 
34
  ## Usage
35
 
36
  ```python
37
  import torch
38
+ import cv2
39
+ import numpy as np
40
  from huggingface_hub import hf_hub_download
41
 
42
+ # Download v5 model
43
  model_path = hf_hub_download(
44
  repo_id="jun710/deep-tattoo",
45
+ filename="edge_aware_v3_clahe_best.pth"
46
  )
47
 
48
  # Load model
49
+ checkpoint = torch.load(model_path, map_location='cpu')
50
+ # Use with EdgeAwareAttentionUNet from the repository
51
+
52
+ # Preprocess with CLAHE
53
+ image = cv2.imread("tattoo.jpg")
54
+ clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
55
+ # ... apply model and extract tattoo
56
  ```
57
 
58
+ ## Model Architecture
59
+
60
+ - **Encoder**: EfficientNet-B3 backbone with edge detection branch
61
+ - **Decoder**: Attention-based skip connections
62
+ - **Output**: Binary segmentation mask (tattoo vs background)
63
+
64
+ ## Training Details
65
+
66
+ - Image Size: 256x256
67
+ - Batch Size: 8
68
+ - Optimizer: Adam (lr=1e-4)
69
+ - Loss: Boundary-Aware Loss (Dice + BCE + Edge)
70
+ - Augmentation: Strong geometric + color transformations
71
+ - Training Data: 189 images (24 manual + 165 auto-generated)
72
+
73
+ ## Performance
74
+
75
+ - Validation Dice: 90.50%
76
+ - Test Coverage: 52 diverse images
77
+ - Success Rate: ~97% on typical tattoos
78
+ - Limitation: Fine details on very delicate outlines (~3% cases)
79
+
80
  ## Repository
81
 
82
  https://github.com/enjius/deep-tattoo