Skip to content

Instantly share code, notes, and snippets.

View poxyu's full-sized avatar

Andrei Spiridonov poxyu

  • ods.ai
  • Barcelona
View GitHub Profile
import torch
from collections import OrderedDict
from typing import List
checkpoints_weights_paths: List[str] = ... # sorted in descending order by score
model: torch.nn.Module = ...
def average_weights(state_dicts: List[dict]):
everage_dict = OrderedDict()
@poxyu
poxyu / albumentations_targets.py
Last active October 4, 2018 06:50
Custom targets for albumentations
# import base class first
# or you'll get such error:
# TypeError: super(type, obj): obj must be an instance or subtype of type
from albumentations import DualTransform
# new targets function
def new_tf_targets(self):
return {
'image': self.apply, # do not rename this one
'image2': self.apply, # new