In [2]:
%reload_ext autoreload
%autoreload 2
%matplotlib inline
In [3]:
from fastai.vision import *
from fastai.metrics import error_rate
In [4]:
path = Path('Database')
In [5]:
path.ls()
Out[5]:
[PosixPath('Database/GoodPLR_0.404_7581.jpg'),
 PosixPath('Database/GoodPLR_0.433_2440.jpg'),
 PosixPath('Database/GoodPLR_0.352_5594.jpg'),
 PosixPath('Database/GoodPLR_0.46_5072.jpg'),
 PosixPath('Database/GoodPLR_0.37_914.jpg'),
 PosixPath('Database/GoodPLR_0.404_840.jpg'),
 PosixPath('Database/GoodPLR_0.404_9135.jpg'),
 PosixPath('Database/GoodPLR_0.509_6291.jpg'),
 PosixPath('Database/GoodPLR_0.389_3233.jpg'),
 PosixPath('Database/GoodPLR_0.46_1675.jpg'),
 PosixPath('Database/GoodPLR_0.391_4683.jpg'),
 PosixPath('Database/GoodPLR_0.439_7106.jpg'),
 PosixPath('Database/GoodPLR_0.442_3577.jpg'),
 PosixPath('Database/GoodPLR_0.259_2725.jpg'),
 PosixPath('Database/GoodPLR_0.463_3786.jpg'),
 PosixPath('Database/GoodPLR_0.52_3953.jpg'),
 PosixPath('Database/GoodPLR_0.434_7464.jpg'),
 PosixPath('Database/GoodPLR_0.349_8029.jpg'),
 PosixPath('Database/GoodPLR_0.421_4339.jpg'),
 PosixPath('Database/GoodPLR_0.339_9193.jpg'),
 PosixPath('Database/GoodPLR_0.404_3004.jpg'),
 PosixPath('Database/GoodPLR_0.36_8549.jpg'),
 PosixPath('Database/GoodPLR_0.362_2952.jpg'),
 PosixPath('Database/GoodPLR_0.37_478.jpg'),
 PosixPath('Database/GoodPLR_0.421_1363.jpg'),
 PosixPath('Database/GoodPLR_0.46_2342.jpg'),
 PosixPath('Database/GoodPLR_0.46_6261.jpg'),
 PosixPath('Database/GoodPLR_0.341_3736.jpg'),
 PosixPath('Database/GoodPLR_0.472_1775.jpg'),
 PosixPath('Database/GoodPLR_0.396_2996.jpg'),
 PosixPath('Database/GoodPLR_0.3_7677.jpg'),
 PosixPath('Database/GoodPLR_0.611_8898.jpg'),
 PosixPath('Database/GoodPLR_0.545_1715.jpg'),
 PosixPath('Database/GoodPLR_0.404_4433.jpg'),
 PosixPath('Database/GoodPLR_0.451_9843.jpg'),
 PosixPath('Database/GoodPLR_0.469_621.jpg'),
 PosixPath('Database/GoodPLR_0.457_649.jpg'),
 PosixPath('Database/GoodPLR_0.451_3790.jpg'),
 PosixPath('Database/GoodPLR_0.527_3408.jpg'),
 PosixPath('Database/GoodPLR_0.412_8090.jpg'),
 PosixPath('Database/GoodPLR_0.439_5332.jpg'),
 PosixPath('Database/GoodPLR_0.509_528.jpg'),
 PosixPath('Database/GoodPLR_0.453_97.jpg'),
 PosixPath('Database/GoodPLR_0.421_5869.jpg'),
 PosixPath('Database/GoodPLR_0.358_9200.jpg'),
 PosixPath('Database/GoodPLR_0.385_8919.jpg'),
 PosixPath('Database/GoodPLR_0.433_4170.jpg'),
 PosixPath('Database/GoodPLR_0.294_7891.jpg'),
 PosixPath('Database/GoodPLR_0.345_4944.jpg'),
 PosixPath('Database/GoodPLR_0.429_3374.jpg'),
 PosixPath('Database/GoodPLR_0.345_1363.jpg'),
 PosixPath('Database/GoodPLR_0.358_2210.jpg'),
 PosixPath('Database/GoodPLR_0.358_3472.jpg'),
 PosixPath('Database/GoodPLR_0.42_186.jpg'),
 PosixPath('Database/GoodPLR_0.35_9730.jpg'),
 PosixPath('Database/GoodPLR_0.345_2904.jpg'),
 PosixPath('Database/GoodPLR_0.396_866.jpg'),
 PosixPath('Database/GoodPLR_0.321_2785.jpg'),
 PosixPath('Database/GoodPLR_0.472_7271.jpg'),
 PosixPath('Database/GoodPLR_0.383_4186.jpg'),
 PosixPath('Database/GoodPLR_0.256_7193.jpg'),
 PosixPath('Database/GoodPLR_0.5_8621.jpg'),
 PosixPath('Database/GoodPLR_0.389_387.jpg'),
 PosixPath('Database/GoodPLR_0.468_8549.jpg'),
 PosixPath('Database/GoodPLR_0.393_4466.jpg'),
 PosixPath('Database/GoodPLR_0.446_2972.jpg'),
 PosixPath('Database/GoodPLR_0.56_5872.jpg'),
 PosixPath('Database/GoodPLR_0.48_5767.jpg'),
 PosixPath('Database/GoodPLR_0.4_3042.jpg'),
 PosixPath('Database/GoodPLR_0.434_2704.jpg'),
 PosixPath('Database/GoodPLR_0.442_8469.jpg'),
 PosixPath('Database/GoodPLR_0.491_4330.jpg'),
 PosixPath('Database/GoodPLR_0.471_462.jpg'),
 PosixPath('Database/GoodPLR_0.472_7153.jpg'),
 PosixPath('Database/GoodPLR_0.358_9380.jpg'),
 PosixPath('Database/GoodPLR_0.426_4216.jpg'),
 PosixPath('Database/GoodPLR_0.238_1857.jpg'),
 PosixPath('Database/GoodPLR_0.426_4146.jpg'),
 PosixPath('Database/GoodPLR_0.441_5527.jpg'),
 PosixPath('Database/GoodPLR_0.537_4572.jpg'),
 PosixPath('Database/GoodPLR_0.327_121.jpg'),
 PosixPath('Database/GoodPLR_0.412_6757.jpg'),
 PosixPath('Database/GoodPLR_0.35_4755.jpg'),
 PosixPath('Database/GoodPLR_0.391_6700.jpg'),
 PosixPath('Database/GoodPLR_0.408_5190.jpg'),
 PosixPath('Database/GoodPLR_0.442_2803.jpg'),
 PosixPath('Database/GoodPLR_0.462_1921.jpg'),
 PosixPath('Database/GoodPLR_0.417_3765.jpg'),
 PosixPath('Database/GoodPLR_0.446_5492.jpg'),
 PosixPath('Database/GoodPLR_0.438_8798.jpg'),
 PosixPath('Database/GoodPLR_0.537_8547.jpg'),
 PosixPath('Database/GoodPLR_0.404_7475.jpg'),
 PosixPath('Database/GoodPLR_0.481_7662.jpg'),
 PosixPath('Database/GoodPLR_0.439_7177.jpg'),
 PosixPath('Database/GoodPLR_0.455_2387.jpg'),
 PosixPath('Database/GoodPLR_0.473_3151.jpg'),
 PosixPath('Database/GoodPLR_0.365_7357.jpg'),
 PosixPath('Database/GoodPLR_0.418_53.jpg'),
 PosixPath('Database/GoodPLR_0.442_1477.jpg'),
 PosixPath('Database/GoodPLR_0.527_4367.jpg'),
 PosixPath('Database/GoodPLR_0.478_1642.jpg'),
 PosixPath('Database/GoodPLR_0.404_2266.jpg'),
 PosixPath('Database/GoodPLR_0.46_8846.jpg'),
 PosixPath('Database/GoodPLR_0.468_1945.jpg'),
 PosixPath('Database/GoodPLR_0.449_1899.jpg'),
 PosixPath('Database/GoodPLR_0.509_704.jpg'),
 PosixPath('Database/GoodPLR_0.522_2888.jpg'),
 PosixPath('Database/GoodPLR_0.357_238.jpg'),
 PosixPath('Database/GoodPLR_0.429_3697.jpg'),
 PosixPath('Database/GoodPLR_0.529_9426.jpg'),
 PosixPath('Database/GoodPLR_0.472_7543.jpg'),
 PosixPath('Database/GoodPLR_0.479_3398.jpg'),
 PosixPath('Database/GoodPLR_0.48_7067.jpg'),
 PosixPath('Database/GoodPLR_0.451_9265.jpg'),
 PosixPath('Database/GoodPLR_0.345_9173.jpg'),
 PosixPath('Database/GoodPLR_0.377_7544.jpg'),
 PosixPath('Database/GoodPLR_0.483_8133.jpg'),
 PosixPath('Database/GoodPLR_0.5_5843.jpg'),
 PosixPath('Database/GoodPLR_0.385_4206.jpg'),
 PosixPath('Database/GoodPLR_0.365_9072.jpg'),
 PosixPath('Database/GoodPLR_0.489_666.jpg'),
 PosixPath('Database/GoodPLR_0.468_5861.jpg'),
 PosixPath('Database/GoodPLR_0.39_9028.jpg'),
 PosixPath('Database/GoodPLR_0.463_9787.jpg'),
 PosixPath('Database/models'),
 PosixPath('Database/GoodPLR_0.389_6505.jpg'),
 PosixPath('Database/GoodPLR_0.457_3367.jpg'),
 PosixPath('Database/GoodPLR_0.396_4852.jpg'),
 PosixPath('Database/GoodPLR_0.32_3518.jpg'),
 PosixPath('Database/GoodPLR_0.473_6279.jpg'),
 PosixPath('Database/GoodPLR_0.489_619.jpg'),
 PosixPath('Database/GoodPLR_0.357_8261.jpg'),
 PosixPath('Database/GoodPLR_0.4_3232.jpg'),
 PosixPath('Database/GoodPLR_0.446_24.jpg'),
 PosixPath('Database/GoodPLR_0.418_2412.jpg'),
 PosixPath('Database/GoodPLR_0.4_2501.jpg'),
 PosixPath('Database/.ipynb_checkpoints'),
 PosixPath('Database/GoodPLR_0.434_266.jpg'),
 PosixPath('Database/GoodPLR_0.4_1797.jpg'),
 PosixPath('Database/GoodPLR_0.315_5310.jpg'),
 PosixPath('Database/GoodPLR_0.462_200.jpg'),
 PosixPath('Database/GoodPLR_0.365_5661.jpg'),
 PosixPath('Database/GoodPLR_0.442_1653.jpg'),
 PosixPath('Database/GoodPLR_0.5_5120.jpg'),
 PosixPath('Database/GoodPLR_0.52_6453.jpg'),
 PosixPath('Database/GoodPLR_0.421_815.jpg'),
 PosixPath('Database/GoodPLR_0.5_2574.jpg'),
 PosixPath('Database/GoodPLR_0.31_7665.jpg'),
 PosixPath('Database/GoodPLR_0.32_791.jpg'),
 PosixPath('Database/GoodPLR_0.345_6004.jpg'),
 PosixPath('Database/GoodPLR_0.48_4147.jpg'),
 PosixPath('Database/GoodPLR_0.365_7663.jpg'),
 PosixPath('Database/GoodPLR_0.442_9326.jpg'),
 PosixPath('Database/GoodPLR_0.442_9435.jpg'),
 PosixPath('Database/GoodPLR_0.49_192.jpg'),
 PosixPath('Database/GoodPLR_0.39_8593.jpg'),
 PosixPath('Database/GoodPLR_0.42_3708.jpg'),
 PosixPath('Database/GoodPLR_0.479_4228.jpg'),
 PosixPath('Database/GoodPLR_0.426_654.jpg'),
 PosixPath('Database/GoodPLR_0.327_9716.jpg'),
 PosixPath('Database/GoodPLR_0.492_4189.jpg'),
 PosixPath('Database/GoodPLR_0.4_8430.jpg'),
 PosixPath('Database/GoodPLR_0.46_8323.jpg'),
 PosixPath('Database/GoodPLR_0.222_2094.jpg'),
 PosixPath('Database/GoodPLR_0.529_7364.jpg'),
 PosixPath('Database/GoodPLR_0.345_2954.jpg'),
 PosixPath('Database/GoodPLR_0.42_4819.jpg'),
 PosixPath('Database/GoodPLR_0.482_5835.jpg'),
 PosixPath('Database/GoodPLR_0.412_1458.jpg'),
 PosixPath('Database/GoodPLR_0.444_2873.jpg'),
 PosixPath('Database/GoodPLR_0.404_4915.jpg'),
 PosixPath('Database/GoodPLR_0.532_7177.jpg'),
 PosixPath('Database/GoodPLR_0.418_2342.jpg'),
 PosixPath('Database/GoodPLR_0.396_97.jpg'),
 PosixPath('Database/GoodPLR_0.25_2925.jpg'),
 PosixPath('Database/GoodPLR_0.448_3465.jpg'),
 PosixPath('Database/GoodPLR_0.463_8105.jpg'),
 PosixPath('Database/GoodPLR_0.404_3682.jpg'),
 PosixPath('Database/GoodPLR_0.345_8376.jpg'),
 PosixPath('Database/GoodPLR_0.46_3063.jpg'),
 PosixPath('Database/GoodPLR_0.389_470.jpg'),
 PosixPath('Database/GoodPLR_0.442_9570.jpg'),
 PosixPath('Database/GoodPLR_0.455_3528.jpg'),
 PosixPath('Database/GoodPLR_0.431_4040.jpg'),
 PosixPath('Database/GoodPLR_0.426_2715.jpg'),
 PosixPath('Database/GoodPLR_0.415_1981.jpg'),
 PosixPath('Database/GoodPLR_0.42_3102.jpg'),
 PosixPath('Database/GoodPLR_0.4_10.jpg'),
 PosixPath('Database/GoodPLR_0.418_7903.jpg'),
 PosixPath('Database/GoodPLR_0.421_4499.jpg'),
 PosixPath('Database/GoodPLR_0.489_8875.jpg')]
In [6]:
fnames = get_image_files(path)
fnames[:5]
Out[6]:
[PosixPath('Database/GoodPLR_0.404_7581.jpg'),
 PosixPath('Database/GoodPLR_0.433_2440.jpg'),
 PosixPath('Database/GoodPLR_0.352_5594.jpg'),
 PosixPath('Database/GoodPLR_0.46_5072.jpg'),
 PosixPath('Database/GoodPLR_0.37_914.jpg')]
In [44]:
# variable a will determine the nearest digit that the float will be rounded to. 
# small a will result in many classes
def round_nearest(x, a):
    return round(x / a) * a
In [7]:
#pat = r'/([^/]+)_\d+.jpg$'
def get_float_labels(y):
    return (float(y.parts[-1].split('_')[1]))
    
In [ ]:
??ImageDataBunch.from_name_func
In [14]:
np.random.seed(42)
bs = 40
bs = 40
tfms = get_transforms(do_flip=False)
fnames = get_image_files(path)
fnames
Out[14]:
[PosixPath('Database/GoodPLR_0.404_7581.jpg'),
 PosixPath('Database/GoodPLR_0.433_2440.jpg'),
 PosixPath('Database/GoodPLR_0.352_5594.jpg'),
 PosixPath('Database/GoodPLR_0.46_5072.jpg'),
 PosixPath('Database/GoodPLR_0.37_914.jpg'),
 PosixPath('Database/GoodPLR_0.404_840.jpg'),
 PosixPath('Database/GoodPLR_0.404_9135.jpg'),
 PosixPath('Database/GoodPLR_0.509_6291.jpg'),
 PosixPath('Database/GoodPLR_0.389_3233.jpg'),
 PosixPath('Database/GoodPLR_0.46_1675.jpg'),
 PosixPath('Database/GoodPLR_0.391_4683.jpg'),
 PosixPath('Database/GoodPLR_0.439_7106.jpg'),
 PosixPath('Database/GoodPLR_0.442_3577.jpg'),
 PosixPath('Database/GoodPLR_0.259_2725.jpg'),
 PosixPath('Database/GoodPLR_0.463_3786.jpg'),
 PosixPath('Database/GoodPLR_0.52_3953.jpg'),
 PosixPath('Database/GoodPLR_0.434_7464.jpg'),
 PosixPath('Database/GoodPLR_0.349_8029.jpg'),
 PosixPath('Database/GoodPLR_0.421_4339.jpg'),
 PosixPath('Database/GoodPLR_0.339_9193.jpg'),
 PosixPath('Database/GoodPLR_0.404_3004.jpg'),
 PosixPath('Database/GoodPLR_0.36_8549.jpg'),
 PosixPath('Database/GoodPLR_0.362_2952.jpg'),
 PosixPath('Database/GoodPLR_0.37_478.jpg'),
 PosixPath('Database/GoodPLR_0.421_1363.jpg'),
 PosixPath('Database/GoodPLR_0.46_2342.jpg'),
 PosixPath('Database/GoodPLR_0.46_6261.jpg'),
 PosixPath('Database/GoodPLR_0.341_3736.jpg'),
 PosixPath('Database/GoodPLR_0.472_1775.jpg'),
 PosixPath('Database/GoodPLR_0.396_2996.jpg'),
 PosixPath('Database/GoodPLR_0.3_7677.jpg'),
 PosixPath('Database/GoodPLR_0.611_8898.jpg'),
 PosixPath('Database/GoodPLR_0.545_1715.jpg'),
 PosixPath('Database/GoodPLR_0.404_4433.jpg'),
 PosixPath('Database/GoodPLR_0.451_9843.jpg'),
 PosixPath('Database/GoodPLR_0.469_621.jpg'),
 PosixPath('Database/GoodPLR_0.457_649.jpg'),
 PosixPath('Database/GoodPLR_0.451_3790.jpg'),
 PosixPath('Database/GoodPLR_0.527_3408.jpg'),
 PosixPath('Database/GoodPLR_0.412_8090.jpg'),
 PosixPath('Database/GoodPLR_0.439_5332.jpg'),
 PosixPath('Database/GoodPLR_0.509_528.jpg'),
 PosixPath('Database/GoodPLR_0.453_97.jpg'),
 PosixPath('Database/GoodPLR_0.421_5869.jpg'),
 PosixPath('Database/GoodPLR_0.358_9200.jpg'),
 PosixPath('Database/GoodPLR_0.385_8919.jpg'),
 PosixPath('Database/GoodPLR_0.433_4170.jpg'),
 PosixPath('Database/GoodPLR_0.294_7891.jpg'),
 PosixPath('Database/GoodPLR_0.345_4944.jpg'),
 PosixPath('Database/GoodPLR_0.429_3374.jpg'),
 PosixPath('Database/GoodPLR_0.345_1363.jpg'),
 PosixPath('Database/GoodPLR_0.358_2210.jpg'),
 PosixPath('Database/GoodPLR_0.358_3472.jpg'),
 PosixPath('Database/GoodPLR_0.42_186.jpg'),
 PosixPath('Database/GoodPLR_0.35_9730.jpg'),
 PosixPath('Database/GoodPLR_0.345_2904.jpg'),
 PosixPath('Database/GoodPLR_0.396_866.jpg'),
 PosixPath('Database/GoodPLR_0.321_2785.jpg'),
 PosixPath('Database/GoodPLR_0.472_7271.jpg'),
 PosixPath('Database/GoodPLR_0.383_4186.jpg'),
 PosixPath('Database/GoodPLR_0.256_7193.jpg'),
 PosixPath('Database/GoodPLR_0.5_8621.jpg'),
 PosixPath('Database/GoodPLR_0.389_387.jpg'),
 PosixPath('Database/GoodPLR_0.468_8549.jpg'),
 PosixPath('Database/GoodPLR_0.393_4466.jpg'),
 PosixPath('Database/GoodPLR_0.446_2972.jpg'),
 PosixPath('Database/GoodPLR_0.56_5872.jpg'),
 PosixPath('Database/GoodPLR_0.48_5767.jpg'),
 PosixPath('Database/GoodPLR_0.4_3042.jpg'),
 PosixPath('Database/GoodPLR_0.434_2704.jpg'),
 PosixPath('Database/GoodPLR_0.442_8469.jpg'),
 PosixPath('Database/GoodPLR_0.491_4330.jpg'),
 PosixPath('Database/GoodPLR_0.471_462.jpg'),
 PosixPath('Database/GoodPLR_0.472_7153.jpg'),
 PosixPath('Database/GoodPLR_0.358_9380.jpg'),
 PosixPath('Database/GoodPLR_0.426_4216.jpg'),
 PosixPath('Database/GoodPLR_0.238_1857.jpg'),
 PosixPath('Database/GoodPLR_0.426_4146.jpg'),
 PosixPath('Database/GoodPLR_0.441_5527.jpg'),
 PosixPath('Database/GoodPLR_0.537_4572.jpg'),
 PosixPath('Database/GoodPLR_0.327_121.jpg'),
 PosixPath('Database/GoodPLR_0.412_6757.jpg'),
 PosixPath('Database/GoodPLR_0.35_4755.jpg'),
 PosixPath('Database/GoodPLR_0.391_6700.jpg'),
 PosixPath('Database/GoodPLR_0.408_5190.jpg'),
 PosixPath('Database/GoodPLR_0.442_2803.jpg'),
 PosixPath('Database/GoodPLR_0.462_1921.jpg'),
 PosixPath('Database/GoodPLR_0.417_3765.jpg'),
 PosixPath('Database/GoodPLR_0.446_5492.jpg'),
 PosixPath('Database/GoodPLR_0.438_8798.jpg'),
 PosixPath('Database/GoodPLR_0.537_8547.jpg'),
 PosixPath('Database/GoodPLR_0.404_7475.jpg'),
 PosixPath('Database/GoodPLR_0.481_7662.jpg'),
 PosixPath('Database/GoodPLR_0.439_7177.jpg'),
 PosixPath('Database/GoodPLR_0.455_2387.jpg'),
 PosixPath('Database/GoodPLR_0.473_3151.jpg'),
 PosixPath('Database/GoodPLR_0.365_7357.jpg'),
 PosixPath('Database/GoodPLR_0.418_53.jpg'),
 PosixPath('Database/GoodPLR_0.442_1477.jpg'),
 PosixPath('Database/GoodPLR_0.527_4367.jpg'),
 PosixPath('Database/GoodPLR_0.478_1642.jpg'),
 PosixPath('Database/GoodPLR_0.404_2266.jpg'),
 PosixPath('Database/GoodPLR_0.46_8846.jpg'),
 PosixPath('Database/GoodPLR_0.468_1945.jpg'),
 PosixPath('Database/GoodPLR_0.449_1899.jpg'),
 PosixPath('Database/GoodPLR_0.509_704.jpg'),
 PosixPath('Database/GoodPLR_0.522_2888.jpg'),
 PosixPath('Database/GoodPLR_0.357_238.jpg'),
 PosixPath('Database/GoodPLR_0.429_3697.jpg'),
 PosixPath('Database/GoodPLR_0.529_9426.jpg'),
 PosixPath('Database/GoodPLR_0.472_7543.jpg'),
 PosixPath('Database/GoodPLR_0.479_3398.jpg'),
 PosixPath('Database/GoodPLR_0.48_7067.jpg'),
 PosixPath('Database/GoodPLR_0.451_9265.jpg'),
 PosixPath('Database/GoodPLR_0.345_9173.jpg'),
 PosixPath('Database/GoodPLR_0.377_7544.jpg'),
 PosixPath('Database/GoodPLR_0.483_8133.jpg'),
 PosixPath('Database/GoodPLR_0.5_5843.jpg'),
 PosixPath('Database/GoodPLR_0.385_4206.jpg'),
 PosixPath('Database/GoodPLR_0.365_9072.jpg'),
 PosixPath('Database/GoodPLR_0.489_666.jpg'),
 PosixPath('Database/GoodPLR_0.468_5861.jpg'),
 PosixPath('Database/GoodPLR_0.39_9028.jpg'),
 PosixPath('Database/GoodPLR_0.463_9787.jpg'),
 PosixPath('Database/GoodPLR_0.389_6505.jpg'),
 PosixPath('Database/GoodPLR_0.457_3367.jpg'),
 PosixPath('Database/GoodPLR_0.396_4852.jpg'),
 PosixPath('Database/GoodPLR_0.32_3518.jpg'),
 PosixPath('Database/GoodPLR_0.473_6279.jpg'),
 PosixPath('Database/GoodPLR_0.489_619.jpg'),
 PosixPath('Database/GoodPLR_0.357_8261.jpg'),
 PosixPath('Database/GoodPLR_0.4_3232.jpg'),
 PosixPath('Database/GoodPLR_0.446_24.jpg'),
 PosixPath('Database/GoodPLR_0.418_2412.jpg'),
 PosixPath('Database/GoodPLR_0.4_2501.jpg'),
 PosixPath('Database/GoodPLR_0.434_266.jpg'),
 PosixPath('Database/GoodPLR_0.4_1797.jpg'),
 PosixPath('Database/GoodPLR_0.315_5310.jpg'),
 PosixPath('Database/GoodPLR_0.462_200.jpg'),
 PosixPath('Database/GoodPLR_0.365_5661.jpg'),
 PosixPath('Database/GoodPLR_0.442_1653.jpg'),
 PosixPath('Database/GoodPLR_0.5_5120.jpg'),
 PosixPath('Database/GoodPLR_0.52_6453.jpg'),
 PosixPath('Database/GoodPLR_0.421_815.jpg'),
 PosixPath('Database/GoodPLR_0.5_2574.jpg'),
 PosixPath('Database/GoodPLR_0.31_7665.jpg'),
 PosixPath('Database/GoodPLR_0.32_791.jpg'),
 PosixPath('Database/GoodPLR_0.345_6004.jpg'),
 PosixPath('Database/GoodPLR_0.48_4147.jpg'),
 PosixPath('Database/GoodPLR_0.365_7663.jpg'),
 PosixPath('Database/GoodPLR_0.442_9326.jpg'),
 PosixPath('Database/GoodPLR_0.442_9435.jpg'),
 PosixPath('Database/GoodPLR_0.49_192.jpg'),
 PosixPath('Database/GoodPLR_0.39_8593.jpg'),
 PosixPath('Database/GoodPLR_0.42_3708.jpg'),
 PosixPath('Database/GoodPLR_0.479_4228.jpg'),
 PosixPath('Database/GoodPLR_0.426_654.jpg'),
 PosixPath('Database/GoodPLR_0.327_9716.jpg'),
 PosixPath('Database/GoodPLR_0.492_4189.jpg'),
 PosixPath('Database/GoodPLR_0.4_8430.jpg'),
 PosixPath('Database/GoodPLR_0.46_8323.jpg'),
 PosixPath('Database/GoodPLR_0.222_2094.jpg'),
 PosixPath('Database/GoodPLR_0.529_7364.jpg'),
 PosixPath('Database/GoodPLR_0.345_2954.jpg'),
 PosixPath('Database/GoodPLR_0.42_4819.jpg'),
 PosixPath('Database/GoodPLR_0.482_5835.jpg'),
 PosixPath('Database/GoodPLR_0.412_1458.jpg'),
 PosixPath('Database/GoodPLR_0.444_2873.jpg'),
 PosixPath('Database/GoodPLR_0.404_4915.jpg'),
 PosixPath('Database/GoodPLR_0.532_7177.jpg'),
 PosixPath('Database/GoodPLR_0.418_2342.jpg'),
 PosixPath('Database/GoodPLR_0.396_97.jpg'),
 PosixPath('Database/GoodPLR_0.25_2925.jpg'),
 PosixPath('Database/GoodPLR_0.448_3465.jpg'),
 PosixPath('Database/GoodPLR_0.463_8105.jpg'),
 PosixPath('Database/GoodPLR_0.404_3682.jpg'),
 PosixPath('Database/GoodPLR_0.345_8376.jpg'),
 PosixPath('Database/GoodPLR_0.46_3063.jpg'),
 PosixPath('Database/GoodPLR_0.389_470.jpg'),
 PosixPath('Database/GoodPLR_0.442_9570.jpg'),
 PosixPath('Database/GoodPLR_0.455_3528.jpg'),
 PosixPath('Database/GoodPLR_0.431_4040.jpg'),
 PosixPath('Database/GoodPLR_0.426_2715.jpg'),
 PosixPath('Database/GoodPLR_0.415_1981.jpg'),
 PosixPath('Database/GoodPLR_0.42_3102.jpg'),
 PosixPath('Database/GoodPLR_0.4_10.jpg'),
 PosixPath('Database/GoodPLR_0.418_7903.jpg'),
 PosixPath('Database/GoodPLR_0.421_4499.jpg'),
 PosixPath('Database/GoodPLR_0.489_8875.jpg')]

data = ImageDataBunch.from_name_func(path, fnames, get_float_labels, ds_tfms=get_transforms(), size=224, ).normalize(imagenet_stats)

In [16]:
data = (ImageItemList(fnames)
        .random_split_by_pct(0.3)
        .label_from_func(get_float_labels)
        .transform(tfms, size=224)
        .databunch())
In [17]:
data.bs = bs
In [19]:
learn = create_cnn(data, models.resnet50, metrics=[mean_squared_error])
In [20]:
data.show_batch(rows=3, figsize=(7,6))
In [21]:
learn = create_cnn(data, models.resnet50,metrics=error_rate)
In [50]:
learn.model
Out[50]:
Sequential(
  (0): Sequential(
    (0): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
    (1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): ReLU(inplace)
    (3): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
    (4): Sequential(
      (0): Bottleneck(
        (conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
        (downsample): Sequential(
          (0): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        )
      )
      (1): Bottleneck(
        (conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (2): Bottleneck(
        (conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
    )
    (5): Sequential(
      (0): Bottleneck(
        (conv1): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
        (downsample): Sequential(
          (0): Conv2d(256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)
          (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        )
      )
      (1): Bottleneck(
        (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (2): Bottleneck(
        (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (3): Bottleneck(
        (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
    )
    (6): Sequential(
      (0): Bottleneck(
        (conv1): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
        (downsample): Sequential(
          (0): Conv2d(512, 1024, kernel_size=(1, 1), stride=(2, 2), bias=False)
          (1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        )
      )
      (1): Bottleneck(
        (conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (2): Bottleneck(
        (conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (3): Bottleneck(
        (conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (4): Bottleneck(
        (conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (5): Bottleneck(
        (conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
    )
    (7): Sequential(
      (0): Bottleneck(
        (conv1): Conv2d(1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
        (downsample): Sequential(
          (0): Conv2d(1024, 2048, kernel_size=(1, 1), stride=(2, 2), bias=False)
          (1): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        )
      )
      (1): Bottleneck(
        (conv1): Conv2d(2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
      (2): Bottleneck(
        (conv1): Conv2d(2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace)
      )
    )
  )
  (1): Sequential(
    (0): AdaptiveConcatPool2d(
      (ap): AdaptiveAvgPool2d(output_size=1)
      (mp): AdaptiveMaxPool2d(output_size=1)
    )
    (1): Flatten()
    (2): BatchNorm1d(4096, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (3): Dropout(p=0.25)
    (4): Linear(in_features=4096, out_features=512, bias=True)
    (5): ReLU(inplace)
    (6): BatchNorm1d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (7): Dropout(p=0.5)
    (8): Linear(in_features=512, out_features=5, bias=True)
  )
)
In [22]:
learn.fit_one_cycle(4)
0.00% [0/4 00:00<00:00]
epoch train_loss valid_loss error_rate
Interrupted
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-22-495233eaf2b4> in <module>
----> 1 learn.fit_one_cycle(4)

~/anaconda3/lib/python3.7/site-packages/fastai/train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, wd, callbacks, tot_epochs, start_epoch)
     20     callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor, pct_start=pct_start, tot_epochs=tot_epochs, 
     21                                        start_epoch=start_epoch))
---> 22     learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
     23 
     24 def lr_find(learn:Learner, start_lr:Floats=1e-7, end_lr:Floats=10, num_it:int=100, stop_div:bool=True, wd:float=None):

~/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks)
    176         callbacks = [cb(self) for cb in self.callback_fns] + listify(callbacks)
    177         fit(epochs, self.model, self.loss_func, opt=self.opt, data=self.data, metrics=self.metrics,
--> 178             callbacks=self.callbacks+callbacks)
    179 
    180     def create_opt(self, lr:Floats, wd:Floats=0.)->None:

~/anaconda3/lib/python3.7/site-packages/fastai/utils/mem.py in wrapper(*args, **kwargs)
     78 
     79         try:
---> 80             return func(*args, **kwargs)
     81         except Exception as e:
     82             if ("CUDA out of memory" in str(e) or

~/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics)
     93             if not data.empty_val:
     94                 val_loss = validate(model, data.valid_dl, loss_func=loss_func,
---> 95                                        cb_handler=cb_handler, pbar=pbar)
     96             else: val_loss=None
     97             if cb_handler.on_epoch_end(val_loss): break

~/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in validate(model, dl, loss_func, cb_handler, pbar, average, n_batch)
     55             if not is_listy(yb): yb = [yb]
     56             nums.append(yb[0].shape[0])
---> 57             if cb_handler and cb_handler.on_batch_end(val_losses[-1]): break
     58             if n_batch and (len(nums)>=n_batch): break
     59         nums = np.array(nums, dtype=np.float32)

~/anaconda3/lib/python3.7/site-packages/fastai/callback.py in on_batch_end(self, loss)
    257         "Handle end of processing one batch with `loss`."
    258         self.state_dict['last_loss'] = loss
--> 259         stop = np.any(self('batch_end', not self.state_dict['train']))
    260         if self.state_dict['train']:
    261             self.state_dict['iteration'] += 1

~/anaconda3/lib/python3.7/site-packages/fastai/callback.py in __call__(self, cb_name, call_mets, **kwargs)
    198     def __call__(self, cb_name, call_mets=True, **kwargs)->None:
    199         "Call through to all of the `CallbakHandler` functions."
--> 200         if call_mets: [getattr(met, f'on_{cb_name}')(**self.state_dict, **kwargs) for met in self.metrics]
    201         return [getattr(cb, f'on_{cb_name}')(**self.state_dict, **kwargs) for cb in self.callbacks]
    202 

~/anaconda3/lib/python3.7/site-packages/fastai/callback.py in <listcomp>(.0)
    198     def __call__(self, cb_name, call_mets=True, **kwargs)->None:
    199         "Call through to all of the `CallbakHandler` functions."
--> 200         if call_mets: [getattr(met, f'on_{cb_name}')(**self.state_dict, **kwargs) for met in self.metrics]
    201         return [getattr(cb, f'on_{cb_name}')(**self.state_dict, **kwargs) for cb in self.callbacks]
    202 

~/anaconda3/lib/python3.7/site-packages/fastai/callback.py in on_batch_end(self, last_output, last_target, **kwargs)
    292         if not is_listy(last_target): last_target=[last_target]
    293         self.count += last_target[0].size(0)
--> 294         self.val += last_target[0].size(0) * self.func(last_output, *last_target).detach().cpu()
    295 
    296     def on_epoch_end(self, **kwargs):

~/anaconda3/lib/python3.7/site-packages/fastai/metrics.py in error_rate(input, targs)
     42 def error_rate(input:Tensor, targs:Tensor)->Rank0Tensor:
     43     "1 - `accuracy`"
---> 44     return 1 - accuracy(input, targs)
     45 
     46 def dice(input:Tensor, targs:Tensor, iou:bool=False)->Rank0Tensor:

~/anaconda3/lib/python3.7/site-packages/fastai/metrics.py in accuracy(input, targs)
     27     input = input.argmax(dim=-1).view(n,-1)
     28     targs = targs.view(n,-1)
---> 29     return (input==targs).float().mean()
     30 
     31 def accuracy_thresh(y_pred:Tensor, y_true:Tensor, thresh:float=0.5, sigmoid:bool=True)->Rank0Tensor:

RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 'other'
In [52]:
interp = ClassificationInterpretation.from_learner(learn)
In [53]:
interp.plot_confusion_matrix(figsize=(12,12), dpi=60)
In [23]:
learn.lr_find()
LR Finder is complete, type {learner_name}.recorder.plot() to see the graph.
In [ ]:
learn.recorder.plot()
In [ ]:
learn.save('PLRstage1')
In [ ]:
learn.unfreeze()
In [ ]:
learn.fit_one_cycle(2, max_lr=slice(3e-4,2e-2))
In [ ]:
learn.save('stage-2')
In [ ]:
learn.load('PLRstage1')
In [ ]:
import os, random
In [ ]:
randomchoice = random.choice(os.listdir("/home/ubuntu/Eyetrain/Database/"))
randomchoice
In [ ]:
img = open_image('/home/ubuntu/Eyetrain/Database/'+randomchoice)
img
In [ ]:
log_preds = learn.predict(img)
log_preds
In [ ]:
log_preds[0]
In [ ]:
e^0.268269
In [ ]: