This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch.utils.data import SubsetRandomSampler as SubSetRandSampler | |
import torchvision.transforms as transforms | |
import torchvision.datasets as datasets | |
import matplotlib.pyplot as plt | |
my_sampler_size = 5000 # I'm going to randomly sample 5000 items from the dataset | |
# Why using this instead of shuffle? Because I want to get less samples than the whole dataset | |
# would using an if statement inside the validation function be good ... something like if i>my_sampler_size: break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Feb 27 18:36:33 2019 | |
@author: malrawi | |
""" | |
import numpy as np | |
from collections import Counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Feb 27 18:36:33 2019 | |
@author: malrawi | |
""" | |
import numpy as np | |
from collections import Counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
img = Image.open("bride.jpg") | |
img.show() | |
img = Image.eval(img, lambda px: (px**2) % 255) # f = f^2 % 255 | |
img.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Oct 5 11:29:33 2018 | |
@author: malrawi | |
""" | |
import torchvision | |
from PIL import Image |