Skip to content

Instantly share code, notes, and snippets.

Avatar

Vishal Jain jainxy

  • Bengaluru, India
View GitHub Profile
@jainxy
jainxy / models_def_samples_pub.py
Created Mar 3, 2021
Model architecture samples
View models_def_samples_pub.py
"""
A collection of models we'll use to attempt to classify videos.
"""
from keras.layers import Dense, Flatten, Dropout, ZeroPadding3D
from keras.layers.recurrent import LSTM
from keras.models import Sequential, load_model
from keras.optimizers import Adam, RMSprop
from keras.layers.wrappers import TimeDistributed
from keras.layers.convolutional import (Conv2D, MaxPooling3D, Conv3D,
MaxPooling2D)
@jainxy
jainxy / keras_samples.py
Created Mar 3, 2021
Keras and related code samples
View keras_samples.py
"""
Training
Validation on a holdout set generated from the original training data
Evaluation on the test data
- correct and test batch generation
- Normalize input by 255?
- add batchnorm layers? use model(x, training=False) then
- tf.data.Dataset.from_tensor_slices((x_train, y_train)).batch(batch_size) ? dataset = dataset.cache()?
- get_compiled_model()
- test last batch having non-dividing batch-size aka residual batch issue
@jainxy
jainxy / scikit_samples.py
Created Mar 3, 2021
Scikit-learn and related code samples
View scikit_samples.py
# Which attributes/features to choose?
# Which model to use?
# Tune/optimize the chosen model for the best performance
# Ensuring the trained model will generalize to unseen data
# Estimate performance of the trained model on unseen data
# imports
import sklearn
import IPython.display
import matplotlib.pyplot as plt
@jainxy
jainxy / git-bundles.md
Created Feb 23, 2021 — forked from PHPirates/git-bundles.md
How to use git bundles
View git-bundles.md

Let machine M be the Main machine with the repo, and A the Auxiliary machine which wants to help out.

First time setup

  1. Machine M creates bundle with complete repo:
git bundle create repo.bundle HEAD master
  1. M sends repo.bundle to A.
  2. A clones repo from bundle:
@jainxy
jainxy / Useful Links on Tech
Last active Feb 23, 2021
Good resources over web on variety of tech topics
View Useful Links on Tech
@jainxy
jainxy / Dockerfile notes
Last active Oct 26, 2020
Description of various commands available for usage in the dockerfile
View Dockerfile notes
References -
1. https://www.howtoforge.com/tutorial/how-to-create-docker-images-with-dockerfile/
2. https://takacsmark.com/dockerfile-tutorial-by-example-dockerfile-best-practices-2018/
3. https://docs.docker.com/engine/reference/builder/
Notes -
- A script or receipe having collection of commands and instructions, which will be executed in sequence, to build a new docker image.
- Below are some Dockerfile commands and their usage.
1. FROM
- Base docker image to build new image on top. This is 1st command in the Dockerfile. E.g. dockerized ubuntu image.
@jainxy
jainxy / video_to_frames.py
Created Sep 19, 2020 — forked from HaydenFaulkner/video_to_frames.py
Fast frame extraction from videos using Python and OpenCV
View video_to_frames.py
from concurrent.futures import ProcessPoolExecutor, as_completed
import cv2
import multiprocessing
import os
import sys
def print_progress(iteration, total, prefix='', suffix='', decimals=3, bar_length=100):
"""
Call in a loop to create standard out progress bar
@jainxy
jainxy / video_to_frames_decord.py
Created Sep 19, 2020 — forked from HaydenFaulkner/video_to_frames_decord.py
decord version of video_to_frame.py
View video_to_frames_decord.py
import cv2 # still used to save images out
import os
import numpy as np
from decord import VideoReader
from decord import cpu, gpu
def extract_frames(video_path, frames_dir, overwrite=False, start=-1, end=-1, every=1):
"""
Extract frames from a video using decord's VideoReader
@jainxy
jainxy / understanding-word-vectors.ipynb
Created Jun 7, 2020 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jainxy
jainxy / apache-1.txt
Created May 6, 2020
Web Hosting related gists
View apache-1.txt
$ sudo mkdir -p /var/www/test.com/public_html
$ sudo mkdir -p /var/www/example.com/public_html
$ sudo chown -R $USER:$USER /var/www/example.com/public_html
$ sudo chown -R $USER:$USER /var/www/test.com/public_html
$ sudo chmod -R 755 /var/www
Create the virtual hosts configuration files for our two sites
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/test.com.conf