This file contains hidden or 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 cv2 | |
import numpy as np | |
import pickle | |
import os | |
import shutil | |
from torchvision import datasets | |
# %% | |
def unpickle(file): |
This file contains hidden or 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 datasets import load_dataset | |
import os | |
from PIL import Image | |
from tqdm import tqdm | |
os.makedirs("train", exist_ok=True) | |
os.chdir("train") | |
tiny_imagenet = load_dataset('Maysee/tiny-imagenet', split='train') | |
size = 100000 |
This file contains hidden or 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
# Original Code here: | |
# https://github.com/pytorch/examples/blob/master/mnist/main.py | |
import os | |
import gc | |
import time | |
import random | |
from filelock import FileLock | |
import torch | |
from torch import optim |
This file contains hidden or 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
def get_orientation(IOP): | |
orientations = [float(x) for x in IOP] | |
row = orientations[:3] | |
col = orientations[3:] | |
return np.array(row), np.array(col) | |
def get_position(IPP): | |
position = [float(x) for x in IPP] | |
return np.array(position) | |
def get_Spacing(PS): | |
return [float(x) for x in PS] |
This file contains hidden or 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 time | |
import math | |
import numpy as np | |
import pandas as pd | |
import pickle | |
import wandb | |
wandb.init(project="dsa5103-assignment3") | |
# helper functions |
This file contains hidden or 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 PyPDF2 import PdfMerger | |
import os | |
from tqdm import tqdm | |
directory = input("Please input the directory containing all pdfs: ") | |
#Create an instance of PdfFileMerger() class | |
merger = PdfMerger() | |
#Create a list with the file paths |