File size: 327 Bytes
b5426a6
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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