Elf_encoder / src /transforms.py
Anupam-Bh's picture
Upload 77 files (#1)
b5426a6 verified
raw
history blame contribute delete
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