Skip to content

Instantly share code, notes, and snippets.

View wangg12's full-sized avatar

Gu Wang wangg12

View GitHub Profile
import torch
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import torch.optim as optim
import torch.nn.functional as F
import time
from torchvision.models import vgg
# Initialize network
@whophil
whophil / recursive_glob.py
Last active August 2, 2018 02:55
Recursive glob in Python: Find all files matching a glob-style pattern. Adapted from http://stackoverflow.com/a/2186565/6191541
import os
import fnmatch
def recursive_glob(rootdir='.', pattern='*'):
"""Search recursively for files matching a specified pattern.
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
"""
matches = []
@nikitakit
nikitakit / _NOTICE.md
Last active December 15, 2018 21:13
Restoring TensorFlow Models
@GuillaumeFavelier
GuillaumeFavelier / normal_mapping_example.py
Last active April 23, 2019 03:02
This example is a prototype demonstrating normal mapping in VisPy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This example is a prototype demonstrating normal mapping
by comparison between a reference mesh and its flatten
version.
"""
import numpy as np
from vispy import app, gloo
@markedphillips
markedphillips / docker-compose.yml
Last active November 14, 2019 01:34
In a folder "overleaf" with this file, "docker-compose up -d" and your overleaf will magically be updated. This addresses the overleaf base image which has a dated latex package and a broken update mechanism.
version: "2.2"
services:
sharelatex:
restart: always
image: dennis1f/sharelatex-texlive2018 # sharelatex/sharelatex:latest
container_name: sharelatex
depends_on:
mongo:
condition: service_healthy
redis:
@ruotianluo
ruotianluo / test_roialign.py
Created October 6, 2017 02:22
A snippet to show how roialign works
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
@Dref360
Dref360 / coordconv2d.py
Last active February 11, 2020 14:40
Un-scaled version of CoordConv2D
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):
@mjdietzx
mjdietzx / ResNeXt_gan.py
Last active February 14, 2020 18:10
Keras/tensorflow implementation of GAN architecture where generator and discriminator networks are ResNeXt.
from keras import layers
from keras import models
import tensorflow as tf
#
# generator input params
#
rand_dim = (1, 1, 2048) # dimension of the generator's input tensor (gaussian noise)
@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
@bartvm
bartvm / dl-frameworks.rst
Last active December 7, 2020 18:18
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Differentiation

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.