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)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dict(zip(sample_train.columns,sample_train.dtypes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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())))) |
OlderNewer