p1atdev commited on
Commit
c8277ad
1 Parent(s): e4465bd

Upload 2 files

Browse files
image_processing_tagger.py CHANGED
@@ -1,11 +1,8 @@
1
- # copied from ViTImageProcessor (https://github.com/huggingface/transformers/blob/v4.37.2/src/transformers/models/vit/image_processing_vit.py)
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 WDv14TaggerImageProcessor(BaseImageProcessor):
144
  r"""
145
- Constructs a WD v14 Tagger image processor.
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": "WDv14TaggerImageProcessor",
3
  "auto_map": {
4
- "AutoImageProcessor": "image_processing_tagger.WDv14TaggerImageProcessor"
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,