Each transformation is a class with a callable function. An example is shown below.
The input to the transformation function is always a dict, which contain data info like img_path, raw label, etc.
Please write comments for the call function to clarify the required/modified/added keys in the data dict.
Add kwargs in the class init function for extension, which is used to parse global config, such as is_train.
class ToCHWImage(object):
""" convert hwc image to chw image
"""
def __init__(self, channel, **kwargs):
self.is_train = kwargs.get('is_train', True)
def __call__(self, data: dict):
'''
required keys:
- image
modified keys:
- image
'''
img = data['image']
if isinstance(img, Image.Image):
img = np.array(img)
data['image'] = img.transpose((2, 0, 1))
return data
Please add unit test in tests/ut/transforms
for the written transformation and try to cover different cases (inputs and settings).
Please visually check the correctness of the transformation on image and annotation using the jupyter notebook. See transform_tutorial.ipynb
.
shape_list
. Otherwise, the postprocessing method won't be able to map the results back to the orignal image space. On how to record shape_list
, please refer to DetResize.Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》