Skip to content

akira4O4/pytorch-module-transforms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Classification

if __name__ == '__main__':
    interpolation = T.InterpolationMode.BILINEAR

    ct = ClassificationTransform()
    ct.add_random_resized_crop((255, 255)) \
        .add_random_horizontal_flip(0.5) \
        .add_random_vertical_flip(0.5) \
        .add_rand_augment(interpolation=interpolation) \
        .add_augmix(interpolation=interpolation) \
        .add_auto_augment(interpolation=interpolation) \
        .add_color_jitter(0.4, 0.4, 0.7, 0.015) \
        .add_to_tensor() \
        .add_normalize() \
        .add_random_erasing(0.4)

    width, height = 416, 416
    random_data = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
    image = Image.fromarray(random_data, 'RGB')
    out = ct(image)

Detection

if __name__ == '__main__':
    dt = DetectionTransform()
    dt.add_resize((224, 224)) \
        .add_random_hsv() \
        .add_random_vertical_flip(0.5) \
        .add_random_horizontal_flip(0.5) \
        .add_to_tensor() \
        .add_normalize()

    width, height = 416, 416
    image = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
    label = image
    data = (image, label)
    output = dt(data)

Segmentation

if __name__ == '__main__':
    dt = Segmentation()
    dt.add_resize((224, 224)) \
        .add_random_hsv() \
        .add_random_vertical_flip(0.5) \
        .add_random_horizontal_flip(0.5) \
        .add_to_tensor() \
        .add_normalize()

    width, height = 416, 416
    image = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
    label = image
    data = (image, label)
    output = dt(data)

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages