Skip to content

Instantly share code, notes, and snippets.

View adimyth's full-sized avatar
🎯
Focusing

Aditya Mishra adimyth

🎯
Focusing
View GitHub Profile
lstm = model.layers[2]
# Get output from intermediate layer to visualize activations
attn_func = K.function(inputs = [model.get_input_at(0), K.learning_phase()],
outputs = [lstm.output]
)
@adimyth
adimyth / data_provider.py
Last active November 9, 2020 18:04
OCR Attention - TF 2.3 compatible files
# Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@adimyth
adimyth / reports.md
Created November 21, 2020 06:57
Data Science Project Reports
@adimyth
adimyth / setup.md
Last active March 26, 2024 14:14
Ubuntu 20.04 RDP setup

Setup

MacBook Air(macOS Catalina) & Ubuntu 20.04 connected on the same network locally.

Steps

  • Install XRDP and enable
sudo apt install xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
@adimyth
adimyth / stratifiedkfold_regression.py
Created January 19, 2021 11:30
StratifiedKFold Split for Regression Task
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
df = pd.read_csv(path_to_data)
n_bins = 1+np.log2(df.shape[0]) # Sturge's rule
df["bins"] = pd.cut(df.target, n_bins, labels=False)
n_folds = 5
skf = StratifiedKFold(n_splits=n_folds)
@adimyth
adimyth / transfer_learning_pl.py
Created August 25, 2021 08:17
Transfer Learning with Poisson Loss (Pytorch Lightning)
from glob import glob
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
@adimyth
adimyth / php-installation.sh
Last active February 4, 2022 08:19
PHP installation via asdf
sudo apt-get install -y libcurl4-gnutls-dev libjpeg-turbo8-dev libpng-dev
sudo apt-get install -y autoconf \
re2c \
bison \
libsqlite3-dev \
libpq-dev \
libonig-dev \
libfcgi-dev \
libfcgi0ldbl \
libjpeg-dev \
@adimyth
adimyth / httpd.conf
Last active August 9, 2022 07:04
Apache configuration for macos with PHP (Intel)
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure