MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / LoadImageFromFile

Class LoadImageFromFile

PATH/core/data/transforms/pose_transforms.py:183–210  ·  view source on GitHub ↗

Loading image from file. Args: color_type (str): Flags specifying the color type of a loaded image, candidates are 'color', 'grayscale' and 'unchanged'. channel_order (str): Order of channel, candidates are 'bgr' and 'rgb'.

Source from the content-addressed store, hash-verified

181
182
183class LoadImageFromFile:
184 """Loading image from file.
185
186 Args:
187 color_type (str): Flags specifying the color type of a loaded image,
188 candidates are 'color', 'grayscale' and 'unchanged'.
189 channel_order (str): Order of channel, candidates are 'bgr' and 'rgb'.
190 """
191
192 def __init__(self,
193 to_float32=False,
194 color_type='color',
195 channel_order='rgb'):
196 self.to_float32 = to_float32
197 self.color_type = color_type
198 self.channel_order = channel_order
199
200 def __call__(self, results):
201 """Loading image from file."""
202 image_file = results['image_file']
203 img = PetrelHelper.imread(image_file, cv2.IMREAD_COLOR)
204
205 img = img[:, :, ::-1] # BGR -> RGB
206 if img is None:
207 raise ValueError('Fail to read {}'.format(image_file))
208
209 results['image'] = img
210 return results
211
212
213class TopDownRandomFlip:

Callers 4

__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected