Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladimir Iglovikov ternaus

View GitHub Profile
View exampl_setup.py
# 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
View Retinaface_load_model.py
# 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(
@ternaus
ternaus / gist:5a4e47d640f0731850297ba84e4e351e
Last active Jul 27, 2020
Medium. Multitask. Scenario 3.
View gist:5a4e47d640f0731850297ba84e4e351e
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",
@ternaus
ternaus / gist:02f581143a9ebe4a89c1c690ab6736f9
Last active Jul 27, 2020
Medium, multitask, scenario 2
View gist:02f581143a9ebe4a89c1c690ab6736f9
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])
View gist:a6a11847e3a1b0da41fc84de85476ef5
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)
View gist:19fffd7078f6e779e8f0534f34f0216f
import numpy as np
import albumentations.augmentations.functional as F