Skip to content

Instantly share code, notes, and snippets.

View keyurparalkar's full-sized avatar
💻
Focusing

Keyur Paralkar keyurparalkar

💻
Focusing
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keyurparalkar
keyurparalkar / Sitar vs Guitar classification.ipynb
Created October 30, 2018 17:13
Sitar and Guitar classification using resnet34
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keyurparalkar
keyurparalkar / Unet_fastai.ipynb
Created December 29, 2018 14:52
Semantic segmentation on pascal voc dataset using unets.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dict(zip(sample_train.columns,sample_train.dtypes))
@keyurparalkar
keyurparalkar / preprocess_df.py
Created February 29, 2020 08:28
Preprocessing the dataframe of run-length encoding
# reading run-length encoding for all the images present in train_images folder
train_rle = pd.read_csv('train.csv')
#splitting column by label
img = train_rle.iloc[:,0].map(lambda x:x.split('_')[0])
label_name = train_rle.iloc[:,0].map(lambda x:x.split('_')[1])
train_rle['Image'] = img
train_rle['Label_name'] = label_name
train_rle.drop('Image_Label',axis=1,inplace=True)
@keyurparalkar
keyurparalkar / df_view.csv
Created February 29, 2020 08:36
DataFrame view
Image Label_name EncodedPixels
0011165.jpg Fish 264918 937 266318 937 267718 937 269118 937 27...
0011165.jpg Flower 1355565 1002 1356965 1002 1358365 1002 1359765...
0011165.jpg Gravel NaN
0011165.jpg Sugar NaN
@keyurparalkar
keyurparalkar / get_unmerged_mask.py
Last active February 29, 2020 13:03
Gists for explaining segmentation mask creation: p1
def gen_unmerged_mask(train_flag:bool, itemlist: ItemList) -> None:
if(train_flag==True):
fld_name = 'train'
itm_list = itemlist.train.items
else:
fld_name = 'valid'
itm_list = itemlist.valid.items
print('Mask generation started.....')
for file_path in tqdm(itm_list):
file_name = str(file_path).split('/')[-1]
graph TB
    gen_unmerged_mask --> train_flag
    train_flag --> True
    train_flag --> False
    True --fld_name--> 'train'
    False --fld_name--> 'valid'
    'train' --> For_loop{For loop}
    'valid' --> For_loop{For loop}
 For_loop --> itemList(If label exists)
graph TB
    gen_unmerged_mask --> train_flag
    train_flag --> True
    train_flag --> False
    True --fld_name--> 'train'
    False --fld_name--> 'valid'
    'train' --> For_loop{For loop}
    'valid' --> For_loop{For loop}
 For_loop --> itemList(If label exists)
@keyurparalkar
keyurparalkar / mergeMask.py
Created March 1, 2020 07:36
Generating merged mask for training the model
#parent dir path:
label_path_train = pathlib.Path('unmerged_train_labels')
label_path_valid = pathlib.Path('unmerged_valid_labels')
#list of label_files(TRAIN)
label_file_names_train = list(dict.fromkeys(list(map(lambda x: (str(x).split('/')[-1]).split('_')[0], label_path_train.ls()))))
#list of label_files(VALID)
label_file_names_valid = list(dict.fromkeys(list(map(lambda x: (str(x).split('/')[-1]).split('_')[0], label_path_valid.ls()))))