Skip to content

Instantly share code, notes, and snippets.

View abhaymise's full-sized avatar

Abhay Kumar abhaymise

View GitHub Profile
@abhaymise
abhaymise / video_to_frames.py
Created February 8, 2021 05:18 — forked from HaydenFaulkner/video_to_frames.py
Fast frame extraction from videos using Python and OpenCV
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
@abhaymise
abhaymise / conda_commands.txt
Last active June 12, 2019 10:30 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#Install dependency in existing environment
conda install -c conda-forge --name <env_name> scikit-plot ipython notebook numpy pandas scipy matplotlib seaborn scikit-learn scikit-plot Pillow scikit-image opencv joblib mlflow requests tensorflow keras dlib
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
@abhaymise
abhaymise / disp_multiple_images.py
Last active October 4, 2022 14:32 — forked from soply/disp_multiple_images.py
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
from matplotlib.pyplot import imshow
import numpy as np
import math
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from PIL import Image
import requests
from io import BytesIO
def show_images(images, cols = 1, titles = None):
@abhaymise
abhaymise / sprite_image_generator.py
Last active May 20, 2019 10:37 — forked from hlzz/gist:ba6da6e692beceb4da8b4d5387a8eacc
Generate sprite images for tensorboard
#!/usr/bin/python
from PIL import Image
import math
test_image_list = '/home/tianwei/Data/sfm_data/test_image_list' # path to the image list
with open(test_image_list, 'r') as f:
test_images = f.readlines()
test_images = map(str.strip, test_images)
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
image_np = load_image_into_numpy_array(image)
image_np_expanded = np.expand_dims(image_np, axis=0)
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
scores = detection_graph.get_tensor_by_name('detection_scores:0')
classes = detection_graph.get_tensor_by_name('detection_classes:0')