Skip to content

Instantly share code, notes, and snippets.

providerID y_predicted
0 PRV57070 0
1 PRV57070 1
2 PRV57070 0
3 PRV57070 0
4 PRV57070 0
5 PRV57070 1
6 PRV57070 0
7 PRV57070 1
8 PRV57070 0
def final_fun_1(X):
""" function takes raw data as input,preprocessing is done,
feature engineering is performed and predictions made on the
best model already trained"""
d_beneficiary = pd.read_csv('health_cs_data/' + X[0])
d_inpatient = pd.read_csv('health_cs_data/' + X[1])
d_outpatient = pd.read_csv('health_cs_data/' + X[2])
d_labels = pd.read_csv('health_cs_data/' + X[3])
<annotation verified="yes">
<folder>MARMOT_ANNOTATION</folder>
<filename>10.1.1.1.2006_3.bmp</filename>
<path>/home/monika/Desktop/MARMOT_ANNOTATION/10.1.1.1.2006_3.bmp</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>793</width>
<height>1123</height>
res_dim = 1024
if __name__ == "__main__":
"""loading the data,
reading the file annotations,
appending the tabular coordinates to formulate a dataframe
"""
df_org = pd.DataFrame()
directory = '/content/drive/MyDrive/data_cs2'
final_col_directory = '/content/drive/MyDrive/cs2_col'
res_dim = 1024
if __name__ == "__main__":
"""loading the data,
reading the file annotations,
appending the tabular coordinates to formulate a dataframe
"""
df_org = pd.DataFrame()
directory = '/content/drive/MyDrive/data_cs2'
final_col_directory = '/content/drive/MyDrive/cs2_col'
destination_t = '\content\drive\MyDrive\cs2_table'
destination_c = '\content\drive\MyDrive\cs2_col'
for i in df_org['filename'].unique():
# for each unique file, we take the height,width,depth from dataframe
file_width = int(df_org[df_org['filename']==i]['width'].unique())
file_height = int(df_org[df_org['filename']==i]['height'].unique())
# Creating an image array of dtype int32
def normalize_image(input_image):
input_image = tf.cast(input_image, tf.float32) / 255.0
return input_image
def decode_image(img):
img = tf.image.decode_jpeg(img)
return tf.image.resize(img, [img_height, img_width])
def decode_mask_image(img):
img = tf.image.decode_jpeg(img, channels=1)
Model: "tablenet"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_7 (InputLayer) [(None, 228, 228, 3) 0
__________________________________________________________________________________________________
conv1_pad (ZeroPadding2D) (None, 234, 234, 3) 0 input_7[0][0]
__________________________________________________________________________________________________
conv1_conv (Conv2D) (None, 114, 114, 64) 9472 conv1_pad[0][0]
__________________________________________________________________________________________________
def fun_table(x,output):
x = Conv2D(128, (1, 1), activation = 'relu', name='conv7_table')(x)
concatenated = Concatenate()([x, output])
concatenated = Concatenate()([concatenated, output])
x = UpSampling2D(size=(2, 2))(concatenated)
x = UpSampling2D(size=(2, 2))(x)
x = UpSampling2D(size=(2, 2))(x)
x = UpSampling2D(size=(2, 2))(x)
last = tf.keras.layers.Conv2DTranspose(3, 3, strides=2,padding='same', name='table_output')
def fun_column(x,output):
x = Conv2D(128, (1, 1), activation = 'relu', name='conv7_column')(x)
x = Dropout(0.8, name='block7_dropout_1')(x)
concatenated = Concatenate()([x,output])
concatenated = Concatenate()([concatenated,output])
x = UpSampling2D(size=(2, 2))(concatenated)
x = UpSampling2D(size=(2, 2))(x)
x = UpSampling2D(size=(2, 2))(x)
x = UpSampling2D(size=(2, 2))(x)