def _get_next_minibatch(self): try: dataBlob, labelBlob,_ = self.iterator.next() except StopIteration: filenames = data.get_sentence(self.config.get('datafile')) labels = data.get_labels(self.config.get('labelfile')) self.iterator = iter(self.sampleIter(filenames,labels)) dataBlob, labelBlob,_ = self.iterator.next() return {'data': dataBlob, 'labels': labelBlob }
def setup(self, bottom, top): """Setup the ResamplerDataLayer.""" # parse the layer parameter string layer_config = self.param_str self.config = util.load_module(layer_config).config filenames = data.get_sentence(self.config.get('datafile')) labels = data.get_labels(self.config.get('labelfile')) self.sampleIter = iterator.SharedIterator(self.config, deterministic=True,batch_size=self.config.get('batch_size')) self.iterator = iter(self.sampleIter(filenames,labels)) self._name_to_top_map = { 'data': 0, 'labels': 1} top[0].reshape(self.config.get('batch_size'), 3, self.config.get('h'), self.config.get('w')) top[1].reshape(self.config.get('batch_size'))
for _,y in Column_dict.items(): tuple_for_db.append(input("What is the value for {}: ".format(y))) #replace index in case user made a misstake tuple_for_db[0] = int(tuple_for_db[1] + tuple_for_db[2] + tuple_for_db[3]) tuple_for_db = tuple(tuple_for_db) try: db_formulas.add_sentence(tuple_for_db) print("added the value to the db") except: print("Sorry, something went wrong") elif user_choice == "2": chosen_index = input("What is the index of the row you want to change: ") tuple_from_db = db_formulas.get_sentence(int(chosen_index)) #to change a specific value tuple_from_db = list(tuple_from_db) print(tuple_from_db) for item in tuple_from_db: if input("Do you want to change this item: {} y/n ".format(item)) == "y": tuple_from_db[tuple_from_db.index(item)] = input("Type the new value in here: ") tuple_from_db.insert(0,int(chosen_index)) tuple_from_db = tuple(tuple_from_db) try: db_formulas.change_sentence(tuple_from_db[0], tuple_from_db[1:]) except: print("Sorry, something went wrong") else: break