Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

prakashjay prakashjayy

🏠
Working from home
View GitHub Profile
@prakashjayy
prakashjayy / Transfer_Learning_Keras_01.py
Last active Jun 21, 2019
Transfer Learning using Keras
View Transfer_Learning_Keras_01.py
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense, GlobalAveragePooling2D
from keras import backend as k
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, TensorBoard, EarlyStopping
img_width, img_height = 256, 256
train_data_dir = "data/train"
@prakashjayy
prakashjayy / Tranfer_Learning_Keras_02.py
Last active Sep 17, 2019
Transfer Learning using Keras
View Tranfer_Learning_Keras_02.py
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense, GlobalAveragePooling2D
from keras import backend as k
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, TensorBoard, EarlyStopping
img_width, img_height = 256, 256
View matrix.md
\begin{equation*}
\left[ \begin{array}{cccc}
i_{1} & i_{2} & i_{3} \\\end{array} \right] \times \left[ \begin{array}{cccc}
W_{i1j1} & W_{i1j2} & W_{i1j3} \\
W_{i2j1} & W_{i2j2} & W_{i2j3} \\
W_{i3j1} & W_{i3j2} & W_{i3j3} \\ \end{array} \right] = \left[ \begin{array}{cccc}
h_{1in} & h_{2in} & h_{3in} \\\end{array} \right]
\end{equation*}
@prakashjayy
prakashjayy / Dockerfile
Last active Jul 31, 2017
A simple Dockerfile for running Deep Learning models using Volumes
View Dockerfile
# This is the docker image available. I am using cpu version here. If needed there is gpu version available.
FROM bvlc/caffe:cpu
# Copy the file into docker
COPY requirements.txt requirements.txt
# Run the copied file
RUN pip install -r requirements.txt
# create a folder called model1 and copy all the files in the folder into that folder
@prakashjayy
prakashjayy / inception_v3_pytorch.py
Last active Mar 2, 2019
Transfer learning using pytorch
View inception_v3_pytorch.py
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import time
import os
import argparse
## Load the model
@prakashjayy
prakashjayy / fastscript.py
Last active Nov 5, 2020
fastscript usage
View fastscript.py
# Fastscript usage under various instancees
# https://github.com/fastai/fastscript/blob/master/00_core.ipynb
# https://fastcore.fast.ai/script.html
from fastcore.all import *
@call_parse
def test_script(p: Param(help="any basic string", type=str)):
print(len(p))
@prakashjayy
prakashjayy / satellite.py
Created Jun 15, 2021
patch read_generic to Feature collection fuction in aeronetlib.
View satellite.py
@patch_to(ds.FeatureCollection, cls_method=True)
def read_generic(cls,
fp: str,
dst_crs: Union[str, rasterio.crs.CRS]=None,
):
'''
geojson reader and can also be used to ensure the geojson in mapped to a destined crs
'''
with open(fp, 'r', encoding='utf-8') as f:
collection = json.load(f)
@prakashjayy
prakashjayy / satellite_tiles.py
Created Jun 15, 2021
Generating tiles on satellite and its mask respectively.
View satellite_tiles.py
def get_tile_name_path(dst_dir, index, city=city, code=code):
'''
generating specific tile name
'''
dst_tile_name = "{}_{}_{}.tif".format(city, code, str(index).zfill(5))
dst_tile_path = os.path.join(dst_dir, dst_tile_name)
return dst_tile_name, dst_tile_path
def get_tile_transform(parent_transform, pixel_x,pixel_y):
'''