Skip to content

Instantly share code, notes, and snippets.

@salihkaragoz
salihkaragoz / coco_getcat.py
Last active May 23, 2019 12:52
COCO categories
import json
data = json.load(open('instances_train2017.json'))
print data.keys()
#OUTPUT :
# [u'info', u'licenses', u'images', u'annotations', u'categories']
print data['categories']
'''
@salihkaragoz
salihkaragoz / installer.bash
Last active April 20, 2018 11:55
install python3 from source
mkdir /truba/home/{username}/python3
cd python3
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar zxfv Python-3.5.2.tgz
cd Python-3.5.2.tgz
./configure --prefix=/truba/home/{username}/python3
make && make install
export PATH=/truba/home/{username}/python3/Python-3.5.2/:$PATH
export PYTHONPATH=/truba/home/{username}/python3/Python-3.5.2
@salihkaragoz
salihkaragoz / conv_5.py
Last active April 29, 2018 15:06
Cifar 10 arc
def five_convnet(X, model, y=None, reg=0.0):
W1, b1, W2, b2 = model['W1'], model['b1'], model['W2'], model['b2']
W3, b3, W4, b4 = model['W3'], model['b3'], model['W4'], model['b4']
W5, b5, W6, b6 = model['W5'], model['b5'], model['W6'], model['b6']
conv_filter_height, conv_filter_width = W1.shape[2:]
assert conv_filter_height == conv_filter_width, 'Conv filter must be square'
assert conv_filter_height % 2 == 1, 'Conv filter height must be odd'
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import datetime