Kaggle competition: TGS Salt Identification Challenge
model.compile(optimizer=tf.keras.optimizers.Nadam(learning_rate=0.0006),
loss=tf.keras.losses.CategoricalCrossentropy() ,
metrics=['accuracy'] )<train_model>
split_num=3
split_index=[0,1,3]
result = model.fit(train_datagen.flow_from_directory(pathh,
target_size=(240, 240),
color_mode='rgb',
class_mode='categorical',
batch_size=64,
shuffle=True),
epochs=40,
initial_epoch=20,
verbose=1 )<set_options>
def rle_decode(rle_mask):

 if type(rle_mask)==float:
return np.zeros([101,101])
 s = rle_mask.split()
starts, lengths = [np.asarray(x, dtype=int)for x in(s[0:][::2], s[1:][::2])]
starts -= 1
ends = starts + lengths
img = np.zeros(101*101, dtype=np.uint8)
 for lo, hi in zip(starts, ends):
img[lo:hi] = 1
return img.reshape(101,101)

def rle_encode(im):

 pixels = im.flatten()
pixels = np.concatenate([[0], pixels, [0]])
 runs = np.where(pixels[1:] != pixels[:-1])[0] + 1
runs[1::2] -= runs[::2]
return ' '.join(str(x)for x in runs )
gc.collect()<choose_model_class>
test_df=pd.read_csv(".. /input/tgs-salt-identification-challenge/sample_submission.csv",index_col='id' )
model.compile(optimizer=tf.keras.optimizers.Nadam(learning_rate=0.000006),
loss=tf.keras.losses.CategoricalCrossentropy() ,
metrics=['accuracy'] )<train_model>
test_img=np.zeros([18000,101,101])
 for fold in split_index:
test_fold=pd.read_csv(".. /input/fork-of-result-visualization-split-"+str(fold)+"/submission.csv",index_col='id')
 for index,ids in enumerate(test_fold.index):
img=rle_decode(test_fold.loc[ids,'rle_mask'])
 test_img[index]+=img/split_num
test_img=np.round(test_img )
result = model.fit(train_datagen.flow_from_directory(pathh,
target_size=(240, 240),
color_mode='rgb',
class_mode='categorical',
batch_size=64,
shuffle=True),
epochs=60,
initial_epoch=40,
verbose=1 )<set_options>
test_fold=pd.read_csv(".. /input/fork-of-result-visualization-split-0/submission.csv",index_col='id' )
gc.collect()<split>
for index,ids in enumerate(test_df.index):
test_df.loc[ids,'rle_mask']=rle_encode(test_img[index])
<define_variables><EOS> 
test_df.to_csv('submission.csv' )