Skip to content

Instantly share code, notes, and snippets.

Namespace(root='examples/domain_adaptation/image_classification/data/wbc', data='WBC', source=['A', 'M'], target=['W'], train_resizing='crop.resize', val_resizing='crop.resize', resize_size=224, scale=[0.8, 1.0], ratio=[0.8, 1.2], no_hflip=False, norm_mean=(0.485, 0.456, 0.406), norm_std=(0.229, 0.224, 0.225), arch='resnet18', bottleneck_dim=1024, no_pool=False, scratch=False, margin=4.0, trade_off=1.0, batch_size=32, lr=0.004, lr_gamma=0.0002, lr_decay=0.75, momentum=0.9, wd=0.0005, workers=2, epochs=20, iters_per_epoch=1000, print_freq=100, seed=1, per_class_eval=False, log='logs/mdd/WBC_AM2W', phase='train')
/p/home/jusers/starovoitovs1/juwels/projects/tlda/examples/domain_adaptation/image_classification/mdd.py:39: UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.
warnings.warn('You have chosen to seed training. '
train_source_transforms: [Comp
import numpy as np
from sklearn.model_selection import train_test_split
from keras import Model
from keras.layers import Input, LSTM, Conv1D, Conv2D, Reshape, Dense, BatchNormalization, Dropout, concatenate
from keras.callbacks import ModelCheckpoint
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import accuracy_score, precision_recall_fscore_support
def build_model(window_size, n_features, depth):
@starovoitovs
starovoitovs / README.md
Last active July 14, 2020 13:36
GIF animation

GIF animation

Run this command in the directory that contains frames/ directory (needs installed imagemagick)

convert -delay 5 -loop 0 -dispose previous frames/*.png animation.gif

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@starovoitovs
starovoitovs / server.js
Created August 15, 2018 05:52
Simple express server that admits HTML5 routing
const express = require("express");
const compression = require("compression");
const url = require("url");
const path = require("path");
const PORT = 4200;
// resolve pathname whether it is a static file or rewrite it to index.html (default start page for all pages)
const getFilename = (req) => {
const pathname = url.parse(req.url).pathname;
from random import random
from scipy import mean
from math import log, pow
import matplotlib.pyplot as plt
def simulate_single(n):
sample = [random() - 0.5 for _ in range(n)]
@starovoitovs
starovoitovs / xtry.js
Created February 16, 2018 10:11
Try / catch expression
const xtry = (xtry, xcatch, xfinally) => {
try {return xtry()} catch (e) {return xcatch && xcatch()} finally {xfinally && xfinally()}
}
// undefined
xtry(() => {throw new Error})
// default
xtry(() => {throw new Error}, () => "default")
@starovoitovs
starovoitovs / markov.py
Created February 1, 2018 20:28
Uninspiring quotes with Markov chains
import itertools
import random
import nltk
def shuffled(language, term):
# while part of speech tag is not a punctuation mark
while term[1] not in [".", ","]:
yield term[0]