Skip to content

Instantly share code, notes, and snippets.

View divamgupta's full-sized avatar

Divam Gupta divamgupta

View GitHub Profile
@carlthome
carlthome / tfcompile.ipynb
Last active October 11, 2022 16:14
Example of how to use XLA AOT via tfcompile to build a Keras model into a shared library.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rafaspadilha
rafaspadilha / customLayerTutorial.md
Last active August 12, 2022 03:28
Caffe Python Layer

How to create a custom Caffe layer in Python?

This tutorial will guide through the steps to create a simple custom layer for Caffe using python. By the end of it, there are some examples of custom layers.

- Why would I want to do that?

Usually you would create a custom layer to implement a funcionality that isn't available in Caffe, tuning it for your requirements.

- What will I need?

Probably just Python and Caffe installed.

- Is there any downside?

@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active September 13, 2023 03:34
Fine-tuning a Keras model. 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
@udibr
udibr / keras_part_load.py
Last active May 9, 2020 23:12
Load weights to Keras model from file allowing for differences between file and model
import numpy as np
import h5py
import keras.backend as K
def str_shape(x):
return 'x'.join(map(str, x.shape))
def load_weights(model, filepath, lookup={}, ignore=[], transform=None, verbose=True):
"""Modified version of keras load_weights that loads as much as it can.
Useful for transfer learning.
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active April 30, 2024 12:39
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@GilLevi
GilLevi / README.md
Last active June 17, 2023 20:58
Emotion Recognition in the Wild via Convolutional Neural Networks and Mapped Binary Patterns

Gil Levi and Tal Hassner, Emotion Recognition in the Wild via Convolutional Neural Networks and Mapped Binary Patterns

Convolutional neural networks for emotion classification from facial images as described in the following work:

Gil Levi and Tal Hassner, Emotion Recognition in the Wild via Convolutional Neural Networks and Mapped Binary Patterns, Proc. ACM International Conference on Multimodal Interaction (ICMI), Seattle, Nov. 2015

Project page: http://www.openu.ac.il/home/hassner/projects/cnn_emotions/

If you find our models useful, please add suitable reference to our paper in your work.

from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
#AlexNet with batch normalization in Keras
#input image is 224x224
model = Sequential()
model.add(Convolution2D(64, 3, 11, 11, border_mode='full'))
@GilLevi
GilLevi / README.md
Last active July 25, 2023 18:05
Age and Gender Classification using Convolutional Neural Networks
@titipata
titipata / caffe_install.md
Last active January 27, 2022 03:27
My notes on how to install caffe on Ubuntu

Caffe Installation

Note on how to install caffe on Ubuntu. Sucessfully install using CPU, more information for GPU see this link

###Installation

  • verify all the preinstallation according to CUDA guide e.g.
lspci | grep -i nvidia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.