Upload 2 files
Browse files- image_processing_tagger.py +3 -7
- preprocessor_config.json +2 -2
image_processing_tagger.py
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
"""Image processor class for WD v14 Tagger."""
|
4 |
|
5 |
from typing import Optional, List, Dict, Union, Tuple
|
6 |
|
7 |
import numpy as np
|
8 |
-
import cv2
|
9 |
from PIL import Image
|
10 |
|
11 |
from transformers.image_processing_utils import (
|
@@ -36,7 +33,6 @@ from transformers.utils import TensorType, logging
|
|
36 |
logger = logging.get_logger(__name__)
|
37 |
|
38 |
|
39 |
-
# copied from transformers.image_transforms.resize
|
40 |
def resize_with_padding(
|
41 |
image: np.ndarray,
|
42 |
size: Tuple[int, int],
|
@@ -140,9 +136,9 @@ def resize_with_padding(
|
|
140 |
return new_image
|
141 |
|
142 |
|
143 |
-
class
|
144 |
r"""
|
145 |
-
Constructs a WD
|
146 |
|
147 |
Args:
|
148 |
do_resize (`bool`, *optional*, defaults to `True`):
|
|
|
1 |
+
"""Image processor class for WD Tagger."""
|
|
|
|
|
2 |
|
3 |
from typing import Optional, List, Dict, Union, Tuple
|
4 |
|
5 |
import numpy as np
|
|
|
6 |
from PIL import Image
|
7 |
|
8 |
from transformers.image_processing_utils import (
|
|
|
33 |
logger = logging.get_logger(__name__)
|
34 |
|
35 |
|
|
|
36 |
def resize_with_padding(
|
37 |
image: np.ndarray,
|
38 |
size: Tuple[int, int],
|
|
|
136 |
return new_image
|
137 |
|
138 |
|
139 |
+
class WDTaggerImageProcessor(BaseImageProcessor):
|
140 |
r"""
|
141 |
+
Constructs a WD Tagger image processor.
|
142 |
|
143 |
Args:
|
144 |
do_resize (`bool`, *optional*, defaults to `True`):
|
preprocessor_config.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
-
"image_processor_type": "
|
3 |
"auto_map": {
|
4 |
-
"AutoImageProcessor": "image_processing_tagger.
|
5 |
},
|
6 |
"color": [
|
7 |
255,
|
|
|
1 |
{
|
2 |
+
"image_processor_type": "WDTaggerImageProcessor",
|
3 |
"auto_map": {
|
4 |
+
"AutoImageProcessor": "image_processing_tagger.WDTaggerImageProcessor"
|
5 |
},
|
6 |
"color": [
|
7 |
255,
|