The code should run as is with the following dependencies:
pip install transformers datasets baal matplotlib tqdm
| """Good example""" | |
| def random_shift(x, wrg, hrg, row_axis=1, col_axis=2, channel_axis=0, | |
| fill_mode='nearest', cval=0., tx=None, ty=None): | |
| """Performs a random spatial shift of a Numpy image tensor. | |
| # Arguments | |
| x: Input tensor. Must be 3D. | |
| wrg: Width shift range, as a float fraction of the width. | |
| hrg: Height shift range, as a float fraction of the height. | |
| row_axis: Index of axis for rows in the input tensor. | |
| col_axis: Index of axis for columns in the input tensor. |
| import os | |
| from collections import defaultdict | |
| import h5py | |
| import numpy as np | |
| pjoin = os.path.join | |
| def convert_multi_to_single(multipath, fp): |
| import cv2 | |
| import numpy as np | |
| from keras.preprocessing.image import ImageDataGenerator | |
| from keras.utils import Sequence | |
| class MySequence(Sequence): | |
| def __init__(self): | |
| self.path = '~/Images/cat.jpg' | |
| self.imgaug = ImageDataGenerator(rotation_range=20, |
| import keras.backend as K | |
| import tensorflow as tf | |
| from tensorflow.keras.layers import Layer | |
| """Not tested, I'll play around with GANs soon with it.""" | |
| from tensorflow.keras.layers import Conv2D | |
| import numpy as np | |
| class CoordConv2D(Layer): |
| #!/usr/bin/env python | |
| import subprocess | |
| import sys | |
| def get_staged(): | |
| proc = subprocess.Popen(['git', 'diff', '--name-only', '--cached'], stdout=subprocess.PIPE) | |
| staged_files = proc.stdout.readlines() | |
| staged_files = [f.decode('utf-8') for f in staged_files] | |
| staged_files = [f.strip() for f in staged_files] | |
| staged_files = [f for f in staged_files if f.endswith('.py')] |
| import gc | |
| import os | |
| import shutil | |
| import tracemalloc | |
| from pathlib import Path | |
| import numpy as np | |
| from keras import backend as K | |
| from keras import callbacks |
| from typing import Optional | |
| import numpy as np | |
| import torch | |
| from torch.utils.data import DataLoader, TensorDataset | |
| from baal.active import ActiveLearningDataset | |
| class AlternateIterator: |
| import numpy as np | |
| import torch | |
| from ignite.engine import Engine, Events, create_supervised_trainer | |
| from pydantic import BaseModel | |
| from torch.utils.data import DataLoader | |
| from torchvision.datasets import CIFAR10 | |
| from torchvision.models import vgg16 | |
| from torchvision.transforms import transforms | |
| from tqdm import tqdm |
| FROM python:3.7 | |
| WORKDIR /tmp | |
| COPY requirements.txt . | |
| RUN pip install --no-cache \ | |
| -r requirements.txt \ | |
| uwsgi==2.0.19.1 \ | |
| supervisor==4.2.2 \ | |
| label-studio==1.0.2 \ |
The code should run as is with the following dependencies:
pip install transformers datasets baal matplotlib tqdm