taneemishere commited on
Commit
a94700e
β€’
1 Parent(s): 5ee6650

fixes some warnings, model names chanages

Browse files
classes/.DS_Store CHANGED
Binary files a/classes/.DS_Store and b/classes/.DS_Store differ
 
classes/model/.DS_Store CHANGED
Binary files a/classes/model/.DS_Store and b/classes/model/.DS_Store differ
 
classes/model/{pix2code2.py β†’ Main_Model.py} RENAMED
@@ -11,10 +11,10 @@ from .autoencoder_image import *
11
  import os
12
 
13
 
14
- class pix2code2(AModel):
15
  def __init__(self, input_shape, output_size, output_path):
16
  AModel.__init__(self, input_shape, output_size, output_path)
17
- self.name = "pix2code2"
18
 
19
  visual_input = Input(shape=input_shape)
20
 
@@ -39,7 +39,7 @@ class pix2code2(AModel):
39
  hidden_layer_model = Dropout(0.3)(hidden_layer_model)
40
  hidden_layer_result = RepeatVector(CONTEXT_LENGTH)(hidden_layer_model)
41
 
42
- # Make sure the loaded hidden_layer_model_freeze will no longer be updated
43
  for layer in hidden_layer_model_freeze.layers:
44
  layer.trainable = False
45
 
@@ -59,7 +59,7 @@ class pix2code2(AModel):
59
 
60
  self.model = Model(inputs=[visual_input, textual_input], outputs=decoder)
61
 
62
- optimizer = RMSprop(lr=0.0001, clipvalue=1.0)
63
  self.model.compile(loss='categorical_crossentropy', optimizer=optimizer)
64
 
65
  def fit_generator(self, generator, steps_per_epoch):
 
11
  import os
12
 
13
 
14
+ class Main_Model(AModel):
15
  def __init__(self, input_shape, output_size, output_path):
16
  AModel.__init__(self, input_shape, output_size, output_path)
17
+ self.name = "Main_Model"
18
 
19
  visual_input = Input(shape=input_shape)
20
 
 
39
  hidden_layer_model = Dropout(0.3)(hidden_layer_model)
40
  hidden_layer_result = RepeatVector(CONTEXT_LENGTH)(hidden_layer_model)
41
 
42
+ # Making sure the loaded hidden_layer_model_freeze will no longer be updated
43
  for layer in hidden_layer_model_freeze.layers:
44
  layer.trainable = False
45
 
 
59
 
60
  self.model = Model(inputs=[visual_input, textual_input], outputs=decoder)
61
 
62
+ optimizer = RMSprop(learning_rate=0.0001, clipvalue=1.0)
63
  self.model.compile(loss='categorical_crossentropy', optimizer=optimizer)
64
 
65
  def fit_generator(self, generator, steps_per_epoch):
classes/model/__pycache__/pix2code2.cpython-35.pyc DELETED
Binary file (2.83 kB)
 
classes/model/__pycache__/pix2code2.cpython-38.pyc DELETED
Binary file (2.73 kB)
 
classes/model/__pycache__/pix2code2.cpython-39.pyc DELETED
Binary file (2.63 kB)
 
classes/model/bin/{pix2code2.h5 β†’ Main_Model.h5} RENAMED
File without changes
classes/model/bin/{pix2code2.json β†’ Main_Model.json} RENAMED
File without changes
main_program.py CHANGED
@@ -7,12 +7,12 @@ import os.path
7
  from os.path import basename
8
 
9
  from classes.Sampler import *
10
- from classes.model.pix2code2 import *
11
 
12
 
13
  def dsl_code_generation(input_image):
14
  trained_weights_path = "classes/model/bin"
15
- trained_model_name = "pix2code2"
16
  input_path = input_image
17
  output_path = "data/output/"
18
  search_method = "greedy"
@@ -20,7 +20,7 @@ def dsl_code_generation(input_image):
20
  input_shape = meta_dataset[0]
21
  output_size = meta_dataset[1]
22
 
23
- model = pix2code2(input_shape, output_size, trained_weights_path)
24
  model.load(trained_model_name)
25
 
26
  sampler = Sampler(trained_weights_path, input_shape, output_size, CONTEXT_LENGTH)
 
7
  from os.path import basename
8
 
9
  from classes.Sampler import *
10
+ from classes.model.Main_Model import *
11
 
12
 
13
  def dsl_code_generation(input_image):
14
  trained_weights_path = "classes/model/bin"
15
+ trained_model_name = "Main_Model"
16
  input_path = input_image
17
  output_path = "data/output/"
18
  search_method = "greedy"
 
20
  input_shape = meta_dataset[0]
21
  output_size = meta_dataset[1]
22
 
23
+ model = Main_Model(input_shape, output_size, trained_weights_path)
24
  model.load(trained_model_name)
25
 
26
  sampler = Sampler(trained_weights_path, input_shape, output_size, CONTEXT_LENGTH)