Elf_encoder / src /transforms.py
thomaswarford's picture
Upload 77 files
90f531c verified
raw
history blame
327 Bytes
#!/usr/bin/env python
"""
Transforms for images applied using fastai dataloaders.
"""
from fastai import *
from fastai.vision.all import *
class Binarize(Transform):
def __init__(self, threshold=0.8):self.threshold=threshold
def encodes(self, o):
mask = (o > (255 * self.threshold))
return mask * 255