This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import albumentations as A | |
import cv2 | |
bgr_image = cv2.imread("cat1.jpeg") | |
image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2RGB) | |
transform = A.Compose([A.RandomResizedCrop(size=(512, 512), | |
scale=(0.08, 1), | |
ratio=(0.75, 1.33), | |
interpolation=cv2.INTER_AREA, p=0.5)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://raw.githubusercontent.com/ternaus/retinaface/master/setup.py | |
import io | |
import os | |
import re | |
import sys | |
from shutil import rmtree | |
from typing import Tuple, List | |
from setuptools import Command, find_packages, setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/ternaus/retinaface/blob/master/retinaface/pre_trained_models.py | |
from collections import namedtuple | |
from torch.utils import model_zoo | |
from retinaface.predict_single import Model | |
model = namedtuple("model", ["url", "model"]) | |
models = { | |
"resnet50_2020-07-20": model( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import albumentations as A | |
transform = A.Compose([A.HorizontalFlip(p=0.5), | |
A.ShiftScaleRotate(border_mode=cv2.BORDER_CONSTANT, scale_limit=0.3, p=0.5)], | |
bbox_params=albu.BboxParams(format='pascal_voc', label_fields=['category_ids']), | |
keypoint_params=albu.KeypointParams(format='xy'), | |
additional_targets={ | |
"image1": "image", | |
"bboxes1": "bboxes", | |
"mask1": "mask", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import albumentations as A | |
transform = A.Compose([ | |
A.HorizontalFlip(p=0.5), | |
A.GridDistortion(p=0.5), | |
A.RandomCrop(height=1024, width=1024, p=0.5), | |
], p=1) | |
transformed = transform(image=image, masks=[mask, mask2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import albumentations as A | |
transform = A.Compose([ | |
A.HorizontalFlip(p=0.5), | |
A.ShiftScaleRotate(border_mode=cv2.BORDER_CONSTANT, | |
scale_limit=0.3, | |
rotate_limit=(10, 30), | |
p=0.5) | |
], p=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
black . | |
isort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import albumentations.augmentations.functional as F |