Skip to content

Instantly share code, notes, and snippets.

View burnpiro's full-sized avatar
👹

Kemal Erdem burnpiro

👹
View GitHub Profile
@burnpiro
burnpiro / v8.md
Last active May 17, 2024 21:07
Basic V8 guide

Install V8 on Linux

Requirements

  • git

Installation

depot_tools

@burnpiro
burnpiro / a_train.py
Last active May 13, 2022 13:48
Tensorflow 2 custom dataset Sequence
import tensorflow as tf
from data.data_generator import DataGenerator
from config import cfg
## Create train dataset
train_datagen = DataGenerator(file_path=cfg.TRAIN.DATA_PATH, config_path=cfg.TRAIN.ANNOTATION_PATH)
## Create validation dataset
val_generator = DataGenerator(file_path=cfg.TEST.DATA_PATH, config_path=cfg.TEST.ANNOTATION_PATH, debug=False)
@burnpiro
burnpiro / functionOptimisation.md
Created August 1, 2019 13:14
Spread VS JSON.parse performance in function optimisation

Spread vs JSON.parse speed when calling simple function

const N = 100000;

function test(obj) {
  var result = obj.a + obj.b;
  return result;
}
function test2(obj) {
 var result = obj.a + obj.b;
@burnpiro
burnpiro / dicomLookup.ts
Created October 19, 2021 13:51
DICOM Lookup table
export const DicomDictionary = {
'00000000': 'Command Group Length',
'00000001': 'Command Length to End',
'00000002': 'Affected SOP Class UID',
'00000003': 'Requested SOP Class UID',
'00000010': 'Command Recognition Code',
'00000100': 'Command Field',
'00000110': 'Message ID',
'00000120': 'Message ID Being Responded To',
'00000200': 'Initiator',
@burnpiro
burnpiro / tb_example.py
Created October 22, 2020 11:16
TensorBoard example for custom model
# Load the TensorBoard notebook extension
%load_ext tensorboard
# Clear out any prior log data. (optional)
!rm -rf logs
import datetime
import io
import itertools
import numpy as np
@burnpiro
burnpiro / helpers_tb.py
Created October 22, 2020 11:16
List of helpers to generate images for tensorboard
def plot_confusion_matrix(cm, class_names=class_names):
"""
Returns a matplotlib figure containing the plotted confusion matrix.
Args:
cm (array, shape = [n, n]): a confusion matrix of integer classes
class_names (array, shape = [n]): String names of the integer classes
"""
figure = plt.figure(figsize=(8, 8))
plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)
unnormalized_train_data = extract_data(path_to_train_file)
normalized_train_data, train_scale = preproc_data(unnormalized_train_data, norm_cols, scale_cols)
// Create and train model
unnormalized_test_data = extract_data(path_to_test_file)
normalized_test_data, _ = preproc_data(unnormalized_test_data, norm_cols, scale_cols, train_scale)
if scale_cols:
# Scale year and week no but within (0,1)
new_data[scale_cols] = MinMaxScaler(feature_range=(0, 1)).fit(train_scale[scale_cols]).transform(
new_data[scale_cols])
if norm_cols:
# Normalize temp and percipation
new_data[norm_cols] = StandardScaler().fit(train_scale[norm_cols]).transform(new_data[norm_cols])
@burnpiro
burnpiro / preproc_data.py
Created August 6, 2020 16:34
preproc_data
import pandas as pd
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from data_info import cols_to_norm, cols_to_scale
def preproc_data(data, norm_cols=cols_to_norm, scale_cols=cols_to_scale, train_scale=None):
"""
:param data: Dataframe
:param norm_cols: List<string>
:param scale_cols: List<string>
:param train_scale: Dataframe
:return: Tuple(Dataframe, Dataframe)