Skip to content

Instantly share code, notes, and snippets.

View Eurus-Holmes's full-sized avatar
🚀
Flying To The Sun ( • ̀ω ⁃᷄)✧

Feiyang(Vance) Chen Eurus-Holmes

🚀
Flying To The Sun ( • ̀ω ⁃᷄)✧
View GitHub Profile
@peteflorence
peteflorence / pytorch_bilinear_interpolation.md
Last active January 16, 2024 14:18
Bilinear interpolation in PyTorch, and benchmarking vs. numpy

Here's a simple implementation of bilinear interpolation on tensors using PyTorch.

I wrote this up since I ended up learning a lot about options for interpolation in both the numpy and PyTorch ecosystems. More generally than just interpolation, too, it's also a nice case study in how PyTorch magically can put very numpy-like code on the GPU (and by the way, do autodiff for you too).

For interpolation in PyTorch, this open issue calls for more interpolation features. There is now a nn.functional.grid_sample() feature but at least at first this didn't look like what I needed (but we'll come back to this later).

In particular I wanted to take an image, W x H x C, and sample it many times at different random locations. Note also that this is different than upsampling which exhaustively samples and also doesn't give us fle

@omoindrot
omoindrot / tensorflow_finetune.py
Last active February 25, 2024 15:00
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
@flyyufelix
flyyufelix / readme.md
Last active August 5, 2022 15:20
Resnet-152 pre-trained model in Keras

ResNet-152 in Keras

This is an Keras implementation of ResNet-152 with ImageNet pre-trained weights. I converted the weights from Caffe provided by the authors of the paper. The implementation supports both Theano and TensorFlow backends. Just in case you are curious about how the conversion is done, you can visit my blog post for more details.

ResNet Paper:

Deep Residual Learning for Image Recognition.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
arXiv:1512.03385
@fchollet
fchollet / classifier_from_little_data_script_1.py
Last active November 28, 2023 07:12
Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@xcatliu
xcatliu / (已失效)中国区用户在开启 GitHub 两步验证中遇到的问题
Last active March 7, 2024 02:53
(已失效)中国区用户在开启 GitHub 两步验证中遇到的问题
2023.8.28
据多名网友回复,此方法已失效。
最新解决办法请参考此贴:[v2ex: 请问 github 的两步验证(two-factor authentication)大家是怎么做的?](https://www.v2ex.com/t/967533)
https://www.v2ex.com/t/967533
---
@r9y9
r9y9 / download_cmu_arctic.sh
Last active January 5, 2021 11:07
CMU ARCTIC download script
#!/bin/bash
# This is a yet another download script for the cmu arctic speech corpus.
# The corpus will be downloaded in $HOME/data/cmu_arctic/
location=$HOME/data/cmu_arctic/
if [ ! -e $location ]
then
echo "Create " $location
@singlepig
singlepig / classify.py
Created April 17, 2014 07:50
按文件名前缀分类文件。 一个目录下有很多形如2012-08-23 18.20.41.jpg的文件,要将这些文件进行分类,对于2012-08-23 18.20.41.jpg文件, 生成文件夹2012-08 ,将其放到文件夹内。
#!/usr/bin/env python
# encoding: utf-8
'''
按文件名前缀分类文件。
一个目录下有很多形如2012-08-23 18.20.41.jpg的文件,要将这些文件进行分类,对于2012-08-23 18.20.41.jpg文件,
生成文件夹2012-08 ,将其放到文件夹内。
'''
import sys