Skip to content

Instantly share code, notes, and snippets.

View ashishrana160796's full-sized avatar
👣
Am I Blue?

Ashish Rana ashishrana160796

👣
Am I Blue?
  • Mannheim, Germany
View GitHub Profile
@ashishrana160796
ashishrana160796 / repeat_gen.py
Created December 31, 2018 17:48
Combine Images(here, repeating only single image), Add Padding to them(w/ black background) with a grid formation method. Create new images for your image dataset for repeated pattern analysis.
from PIL import Image
import numpy as np
# call with pil_transform('test.jpg')
def pil_transform(image_str):
# padding process started
im_opn = Image.open(image_str)
old_sz = im_opn.size
new_sz = (old_sz[0]+30, old_sz[1]+30)
@ashishrana160796
ashishrana160796 / nac_plot.py
Last active December 27, 2018 17:21
NAC and NALU unit 3-D plot python code with matplotlib library. Can be used as a reference for plotting sigmoid, tanh function also.
'''
NAC 3-D Plot Code
'''
# import statements
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
@ashishrana160796
ashishrana160796 / BBBC_data_preprocess.py
Last active January 1, 2022 22:07
Load Images from BBBC dataset(Here, https://data.broadinstitute.org/bbbc/BBBC005/) and Resize them with PIL python library along with changes their size & for JPEG. After, that split them into test and train directories depending on requirement add conditions for test/train sets.
# Best way to run copy and paste portions into an ipython3 shell
# 1. Import Statements
import operator
from os import listdir
from os.path import isfile, join
# 2. Select files with matching tiff extensions.
import re
import gym
from gym import wrappers
import numpy as np
env = gym.make("FrozenLake-v0")
env = wrappers.Monitor(env, "./results", force=True)
Q = np.zeros([env.observation_space.n, env.action_space.n])
n_s_a = np.zeros([env.observation_space.n, env.action_space.n])
@ashishrana160796
ashishrana160796 / JavaDocCheatSheet.md
Last active April 30, 2024 15:22
JavaDoc CheatSheet : This gist contains basics of JavaDoc comments to get you up and running in no time.

JAVADOC CHEATSHEET

Introduction

The major important thing is the documentation has to be implementation independent and specification concise. Dependencies where ever necessary are allowed to be specified.
Also it is allows HTML tags to be used in between the documentation comments. Pretty much all tags are self explanatory.

Meta Annotations
@author  Ex: @author Jane Doe
@version  Ex: @version v1.0-alpha

@rkwitt
rkwitt / UCSD_Ped_Counting_Dataset.py
Created September 25, 2017 09:42
Data loading for the UCSD pedestrian counting dataset
class UCSD(Dataset):
"""UCSD pedestrian counting data."""
def __init__(self, data_dir, annotation_dir, transform=None):
self.file_list = []
self.file_cnts = []
files = glob.glob(
os.path.join(