def __init__(self, prop, data_queue): # shape of input data self.__cols = prop.queryAttr('cols') self.__batch_n = prop.queryAttr('batch_n') self.__batch_h = prop.queryAttr('batch_h') self.__batch_w = prop.queryAttr('batch_w') self.__sfeatures = prop.queryAttr('sfeatures') self.__ifeatures = prop.queryAttr('ifeatures') self.__batch_c = self.__sfeatures + self.__ifeatures sd = Shared() self.__logger = sd.getLogger() # two networks cnns = prop.queryAttr('cnn_name') self.__data_queue = data_queue # network-1 self.__feed1 = FilterFeed(prop) img_name = cnns[0] + '.png' txt_name = cnns[0] + '.txt' conf_name = cnns[0] + '.json' self.__feed1.setInputName(img_name, txt_name, conf_name) # network-2 self.__feed2 = FilterFeed(prop) img_name = cnns[1] + '.png' txt_name = cnns[1] + '.txt' conf_name = cnns[1] + '.json' self.__feed2.setInputName(img_name, txt_name, conf_name)
def __init__(self, prop, batchQueue): # 从场景中选择切片的数量 self.__sampleNum = 40 sd = Shared() self.__logger = sd.getLogger() # buf size self.__maxBufSize = 300 self.__buf = [] # send batchs to this queue self.__data_queue = batchQueue self.__mode = prop.queryAttr('mode') assert (self.__mode == 'infer' or self.__mode == 'train') # cnn name self.__cnn_name = prop.queryAttr('cnn_name') self.__batch_n = prop.queryAttr('batch_n') self.__batch_h = prop.queryAttr('batch_h') self.__batch_w = prop.queryAttr('batch_w') self.__sfeatures = prop.queryAttr('sfeatures') self.__ifeatures = prop.queryAttr('ifeatures') self.__batch_c = self.__sfeatures + self.__ifeatures self.__ground_truth = prop.queryAttr('ground_truth') # cache self.__cache = prop.queryAttr('cache') # size of image self.__ih = self.__iw = 0 self.__input_dir = prop.queryAttr('data_dir') self.__scene_name = os.listdir(self.__input_dir) if self.__mode == 'train': self.__directories = [(self.__input_dir + itm + '/') for itm in self.__scene_name] else: assert (self.__mode == 'infer') self.__directories = [self.__input_dir]
def __init__(self, max_size): self.__data = {} self.__max_size = max_size self.__MB = 1048576 self.__in = 0 self.__sum = 0 sd = Shared() self.__logger = sd.getLogger()
def readTXT(filename, shape=None): shared = Shared() logger = shared.getLogger() logger.debug('loading txt:%s...' % filename) data = np.loadtxt(filename) if shape: data = np.reshape(data, shape) logger.debug('txt loaded.') return data
def postprocess(self, input1): sd = Shared() self.__logger.debug('postprocessing...') if not self.__isTrain: # path of test data file save_path = self.__output_path utils.saveImage(input1, save_path + 'infer.png') # utils.displayImage(input) sd.setFlag('nowExit', True) print('done')
def del_handler(*args): if not args: print(MISSING_STORE_NAME_ERROR) return store = args[0] location = shared_location(store) if not location: return shared = Shared(store, location=location) shared.delete(*args[1:]) print("Successfully deleted !")
def __init__(self, prop): sd = Shared() self.__logger = sd.getLogger() self.__isTrain = prop.needTrain() # 图像切片维度 self.__batch_h = prop.queryAttr('batch_h') self.__batch_w = prop.queryAttr('batch_w') self.__batch_n = prop.queryAttr('batch_n') # 空间域和图像域特征 self.__sfeatures = prop.queryAttr('sfeatures') self.__ifeatures = prop.queryAttr('ifeatures') self.__batch_c = self.__sfeatures + self.__ifeatures self.__shape1 = [self.__batch_n, self.__batch_h, self.__batch_w, 3] self.__shape2 = [ self.__batch_n, self.__batch_h, self.__batch_w, self.__batch_c ]
def run(self, shared_mem = None): self.load_prediction_matrix(0) self.build_library(0, shared_mem) if self.run_ensemble: self.ensemble(1) self.history_df.to_csv(self.path + 'hist.csv') tmp=Shared() #if self.generate_final_model: #tmp.write('generating final model', -1) #shared_mem.put(tmp) #self.final_model() #tmp.write('generated final model', -1) #shared_mem.put(tmp) tmp.write('generated final report', -1) shared_mem.put(tmp) self.generate_report()
def __init__(self, queue, prop=None): self.__low = 0 self.__high = 300 if prop == None else prop.queryAttr('plot_height') self.__left = 0 self.__right = 100 if prop == None else prop.queryAttr('plot_width') plt.axis([self.__left, self.__right, self.__low, self.__high]) plt.ion() plt.title('run chart') sd = Shared() self.__feed = iRenderFeed(queue) self.__logger = sd.getLogger() self.__xs = [0, 0] self.__ys = [self.__high, self.__high]
def new_handler(*args): if not args: print(MISSING_STORE_NAME_ERROR) return if len(args) > 1: print(INCORRECT_USAGE_ERROR) return store = args[0] Shared(store, location=os.getcwd()) print("Successfully created the store '{}' !".format(store))
def __init__(self, prop): sd = Shared() self.__logger = sd.getLogger() self.__isTrain = True if prop.needTrain() else False self.__input_dir = prop.queryAttr('data_dir') self.__scene_name = os.listdir(self.__input_dir) self.__cols = prop.queryAttr('cols') if self.__isTrain: self.__directories = [(self.__input_dir + itm + '/') for itm in self.__scene_name] self.__ground_truth = prop.queryAttr('ground_truth') self.__batch_h = prop.queryAttr('batch_h') self.__batch_w = prop.queryAttr('batch_w') self.__batch_n = prop.queryAttr('batch_n') self.__sfeatures = prop.queryAttr('sfeatures') self.__ifeatures = prop.queryAttr('ifeatures') self.__batch_c = self.__sfeatures + self.__ifeatures self.__cache_size = prop.queryAttr('cache_size') self.__cache = prop.queryAttr('cache') self.__abandons = []
def __init__(self, prop, name, msg_queue=None): sd = Shared() # 全局唯一日志句柄 self.__logger = sd.getLogger() # 全局唯一会话 self.__sess = prop.queryAttr('session') # self.__sess = utils.getSession() # 卷积网络的字符串命名 self.__name = name # 消息队列,用于中转训练误差数据 self.__queue = msg_queue # 空间域特征 sfeatures = prop.queryAttr('sfeatures') # 图像域特征 ifeatures = prop.queryAttr('ifeatures') # 输入切片的维度 self.__batch_c = sfeatures + ifeatures self.__batch_h = prop.queryAttr('batch_h') self.__batch_w = prop.queryAttr('batch_w') # 图像通道,一般为3 self.__cols = prop.queryAttr('cols') # 卷积网络模型参数 self.__conv_size = prop.queryAttr('conv_size') self.__model_path = prop.queryAttr('model_path') self.__ckpt_name = prop.queryAttr('ckpt_name') self.__active_func = prop.queryAttr('active_func') self.__weights_shape = prop.queryAttr('weights_shape') self.__isTrain = True if prop.needTrain() else False self.__input1 = None self.__input2 = None if self.__isTrain: self.__batch_n = prop.queryAttr('batch_n') self.__loss_func = prop.queryAttr('loss_func') self.__learning_rate = prop.queryAttr('learning_rate') self.__max_round = prop.queryAttr('max_round') # 输入数据目录 self.__data_dir = prop.queryAttr('data_dir') self.__optimizer = prop.queryAttr('optimizer') else: self.__batch_n = 1 colorama.init()
def main(argv=None): sd = Shared() # 全局唯一日志句柄 logger = sd.getLogger() # 当前操作是否可打断 sd.setFlag('safeExit', 0) # 当前是否可退出 sd.setFlag('nowExit', False) # 处理SIGINT信号 signal.signal(signal.SIGINT, handler) # 配置对象 prop = Prop() logger.info(prop.toString()) # 消息队列,用于中转训练误差信息 msg_queue = sd.getQueue('msg') # 数据队列,用于中转训练数据 data_queue = sd.getQueue('data') # 文件调度对象,加载数据数据 sched = IOsched(prop, data_queue) sched.start() # 任务处理对象 mainfeed = MainFeed(prop, data_queue) mainproc = MainProc(prop, mainfeed, msg_queue) mainproc.start() # 走势图绘制 if platform.system() == 'Windows': render = iRender(msg_queue, prop) # 主线程等待终止消息或信号 while not sd.getFlag('nowExit'): if platform.system() == 'Windows': render.process() else: pass
def __init__(self, **traits): super(FFnetApp, self).__init__(**traits) self.network = Network(app = self) self.training_data = TrainingData(app = self) self.testing_data = TrainingData(app = self) self.recall_data = TrainingData(app = self) self.data = self.training_data # by default self.dumper = Dumper(app=self) self.trainer = TncTrainer(app = self) # default trainer self.shared = Shared() self.logs = Logger() self.plots = MPLPlots() self.logs.logger.info('Welcome! You are using ffnet-%s.' %ffnet_version) self.shell = {'app':self}
def handler(sig, frame): sd = Shared() logger = sd.getLogger() logger.debug("\r\r\r\r\r") print('...closing...patient...') while sd.getFlag('safeExit') != 0: pass sd.setFlag('nowExit', True)
def saveImage(data, filename): sd = Shared() sd.incFlag('safeExit') logger = sd.getLogger() src = (data * 255).astype(np.uint8) if len(src.shape) == 4: assert (src.shape[0]) == 1 h = src.shape[1] w = src.shape[2] c = src.shape[3] src = np.reshape(src, [h, w, c]) else: assert (len(src.shape) == 3) spm.toimage(src).save(filename) logger.debug('image saved to \'%s\'' % filename) sd.decFlag('safeExit')
def store_handler(*args): if not args: print(MISSING_STORE_NAME_ERROR) return store = args[0] location = shared_location(store) if not location: return shared = Shared(store, location=location) n = len(args[1:]) if n == 0: # Show store content show_store_content(shared, location) elif n == 1: # Show entry content entry = args[1] show_entry_content(shared, entry) elif n == 3: # Update the content of an entry entry, container, source_filename = args[1:] update_entry_content(shared, entry, container, source_filename) else: print(INCORRECT_USAGE_ERROR)
def save(self, path, name, save_round): sd = Shared() sd.incFlag('safeExit') self.__logger.info('saving model[%s]...' % self.__name) try: os.makedirs(path) self.__logger.info('directory \'%s\' was made for model saving.' % path) except OSError: if not os.path.isdir(path): self.__logger.error( cprint('target path is not a directory', 'red')) return False saver = tf.train.Saver() saver.save(self.__sess, path + name) self.__logger.info('model[%s] saved.' % self.__name) sd.decFlag('safeExit') return True
def index(self): ################################################ # example using session from -> from plugins.session import Session session = Session() #print(dir(bottle.ext)) # set max session age, default is 30 days # parameter in seconds # session.setMaxAge(1) session.add('cd', '3') session.add('dvd', 3) sessionData = session.get() print(sessionData) session.remove('cd') sessionData = session.get() print(sessionData) #print(session.getExpired()) # if you want to clear session use this method # session.clear() ############################################### # example using shared data for from -> from shared import Shared data = Shared().data() data['top_menu'] = { 'start_flybee': 'Start FlyBee', 'about': 'About', 'get_started': 'Get Started' } return template('templates/grayscale/home.html', data=data)
def restore(self, path): if os.path.exists(path + '/checkpoint'): ckpt = tf.train.latest_checkpoint(path) self.__logger.debug('checkpoint path is \'%s\'' % ckpt) try: saver = tf.train.Saver(save_relative_paths=True) saver.restore(self.__sess, ckpt) except: sd = Shared() try: overwrite = sd.getFlag('overwrite') except: overwrite = None if overwrite is not True: cprint( 'model[%s] mismatch! current checkpoint will be overwriten,do you want to continue?' % self.__name, 'yellow') cands = ['y', 'yes', 'n', 'no'] deci = '' while not (deci in cands): deci = input(cprint('y or n:', 'yellow')) if deci == 'y' or deci == 'yes': sd.setFlag('overwrite', True) return False elif deci == 'n' or deci == 'no': sd.setFlag('overwrite', False) exit(-1) else: self.__logger.warn( 'invalid input,please try again...') return False self.__logger.info('model restored from the latest checkpoint.') else: self.__logger.warn('checkpoint not found!') return False return True
def run(self): uk = self.next_uk() while(uk is not None): shared = Shared() shared.execute() uk = self.next_uk()
if __name__ == "__main__": from shared import Shared import time shared = Shared() shared.start_threads() # time.sleep(10) from PyQt5 import QtCore, QtGui, uic, QtWidgets import sys import os import pyqtgraph as pg import numpy as np import pickle sys._excepthook = sys.excepthook def exception_hook(exctype, value, traceback): sys._excepthook(exctype, value, traceback) sys.exit(1) sys.excepthook = exception_hook class Main_Window(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.shared = shared self.initUI() def initUI(self): # self.show() path = os.path.dirname(__file__)
def __init__(self, prop, feed, msg_queue=None): sd = Shared() self.__logger = sd.getLogger() self.__prop = prop self.__feed = feed self.__msg_queue = msg_queue
class FFnetApp(HasTraits): network = Instance(Network) data = Instance(TrainingData) training_data = Instance(TrainingData) testing_data = Instance(TrainingData) recall_data = Instance(TrainingData) dumper = Instance(Dumper) trainer = Instance(Trainer) shared = Instance(Shared) logs = Instance(Logger) plots = Instance(MPLPlots, transient=True) shell = PythonValue(Dict) mode = Enum('train', 'test', 'recall') algorithm = Enum('tnc') #, 'bfgs', 'cg') running = DelegatesTo('trainer') net = DelegatesTo('network') data_status = DelegatesTo('data', prefix='status') selected = DelegatesTo('plots') def __init__(self, **traits): super(FFnetApp, self).__init__(**traits) self.network = Network(app = self) self.training_data = TrainingData(app = self) self.testing_data = TrainingData(app = self) self.recall_data = TrainingData(app = self) self.data = self.training_data # by default self.dumper = Dumper(app=self) self.trainer = TncTrainer(app = self) # default trainer self.shared = Shared() self.logs = Logger() self.plots = MPLPlots() self.logs.logger.info('Welcome! You are using ffnet-%s.' %ffnet_version) self.shell = {'app':self} def new(self): net = self.network.create() if net is not None: self.mode = 'train' self.data.normalize = True self._new_net_setup() def load(self): net = self.network.load() if net is not None: self.mode = 'recall' self._new_net_setup() def save_as(self): self.network.save_as() def export(self): self.network.export() def dump(self): self.dumper.configure_traits(kind='modal') def settings(self): if self.net: self._pmode = self.mode self.edit_traits(view='settings_view', kind='livemodal') def train_start(self): self.logs.logger.info('Training network: %s' %self.network.filename) self.trainer.train() def train_stop(self): self.trainer.running = False def reset(self): if self.net: self.net.randomweights() self.logs.logger.info('Weights has been randomized!') self.clear() def about(self): from about import about about.open() def donate(self): import webbrowser url = 'https://sourceforge.net/p/ffnet/donate' webbrowser.open(url) def cite(self): from pyface.api import information import os try: basedir = os.path.dirname(os.path.realpath(__file__)) + '/' except NameError: #__file__ not defined if this is main script basedir = '' fname = basedir + 'data/cite.txt' citations = open(fname, 'r').read() msg = u'You are encouraged to cite in your papers one (or all) of the following:\n\n\n' + \ unicode(citations, 'utf-8').replace(u'\ufeff', '') information(None, msg, title = "Citing ffnet/ffnetui") def clear(self): self.shared.populate() self.plots.selected.replot() def _arrange_plots(self): if self.mode == 'train': plots = [ErrorAnimation, RegressionAnimation, TOAnimation, DOAnimation, ITOAnimation, DIOAnimation, GraphAnimation] elif self.mode == 'test': plots = [RegressionPlot, TOPlot, DOAnimation, ITOPlot, DIOAnimation, GraphAnimation] else: plots = [OPlot, DOAnimation, IOPlot, DIOAnimation, GraphAnimation] self.plots.classes = plots self.plots.selected.replot() def _new_net_setup(self): self.shared.populate() # Clears all data from previous training data_status = False if self.data.status == 2: data_status = self.data.load() # here we test data if not data_status: self.data.status = 0 self.settings() else: self._arrange_plots() self.logs.logger.info('Using previously loaded data.') def _mode_changed(self): if self.mode == 'train': self.data = self.training_data elif self.mode == 'test': self.data = self.testing_data else: self.data = self.recall_data def _algorithm_changed(self, new): if new == 'tnc': self.trainer = TncTrainer(app=self) if new == 'cg': self.trainer = CgTrainer(app=self) if new == 'bfgs': self.trainer = BfgsTrainer(app=self) def _selected_changed(self, old, new): new.app = self # TODO: Plots should be initialized with 'app=self' ? traits_view = View(VSplit(UItem('plots', style = 'custom', height=0.75, visible_when='len(object.plots.plots) > 0 and ' '((mode in ["train", "test"] and data_status == 2) or ' '(mode in ["recall"] and data_status == 1))'), Tabbed(UItem('logs', style='custom', dock = 'tab', export = 'DockWindowShell'), UItem('shell', label = 'Shell', editor = ShellEditor( share = True ), dock = 'tab', export = 'DockWindowShell' ), ) ), handler = FFnetAppHandler(), title = 'ffnetui-%s' %ffnetui_version, width = 0.6, height = 0.8, resizable = True, toolbar = toolbar, menubar = menubar, #statusbar = [StatusItem(name = 'net_info', width=0.5), #StatusItem(name = 'data_info', width=0.5)] ) settings_view = View(Item('mode', emphasized=True), '_', Group(Item('object.data.input_loader', style='custom', label='Input file',), Item('object.data.target_loader', style='custom', label='Target file'), Group(Item('object.data.validation_patterns', label = 'Validation patterns [%]'), Item('object.data.validation_type'), Item('object.data.normalize')), visible_when = 'mode == "train"'), Group(Item('object.data.input_loader', style='custom', label='Input file',), Item('object.data.target_loader', style='custom', label='Target file'), visible_when = 'mode == "test"'), Group(Item('object.data.input_loader', style='custom', label='Input file',), visible_when = 'mode == "recall"'), '_', Group(Item('algorithm', label = 'Training algorithm'), UItem('object.trainer', style='custom'), Item('object.trainer.best_weights'), visible_when='mode == "train"'), buttons = ['OK', 'Cancel'], handler = SettingsHandler(), title = 'Settings...', resizable = True, #scrollable = True, width = 0.4)
""" (C) Armin Bahl, Dec. 2019 [email protected] """ if __name__ == "__main__": from shared import Shared shared = Shared() shared.load_values() shared.start_threads() import os import sys import PyQt5 from PyQt5 import QtCore, QtGui, uic, QtWidgets # Some properties that one might need to set on high-res screens if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'): PyQt5.QtWidgets.QApplication.setAttribute( QtCore.Qt.AA_EnableHighDpiScaling, True) if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'): PyQt5.QtWidgets.QApplication.setAttribute( QtCore.Qt.AA_UseHighDpiPixmaps, True) class GUI_Dialog(QtWidgets.QDialog): def __init__(self, parent=None): super().__init__()
stimuli = [] t_stimuli = [] coherences = [0, 25, 50, 100] directions = [-1, 1] # left, right number_fish = 2 for direction in directions: for coherence in coherences: stimuli.append([direction, coherence]) t_stimuli.append( 20) # 5s 0% coherence, 10s coherence level, 5s 0% shared = Shared(r'C:\LS100\LS100_free_swimming_4fish_data', "dot_motion_coherence_new", stimuli=stimuli, t_stimuli=t_stimuli, shaders=[dot_motion_shader], python_file=__file__) shared.start_threads() from scene import Scene from panda3d.core import * class World(Scene): def __init__(self): # Init the scene Scene.__init__(self, shared=shared) self.background_circle = dict({})
# Robert DeRosa # Python Advanced: Task Manager Classes # --Task Manager with Uses-- from shared import Shared from main_menu import main_menu_funct from users import Users from create import Create from edit import Edit from read import Read shared = Shared() users = Users(shared) def main(): cur_user = users.add_user() while True: create = Create(shared, cur_user) edit = Edit(shared, cur_user) read = Read(shared, cur_user) print(f"\nCurrent User: {cur_user}") choice = main_menu_funct() if choice == 0: break if choice == 1: create.create() if choice == 2: read.read_by_date()
from shared import Shared from scene import Scene from panda3d.core import * # default black bg, black circle # circle = True # moving = False # gray = False stimuli = [0] t_stimuli = [5 * 60] number_fish = 2 shared = Shared(r'C:\LS100\LS100_free_swimming_4fish_data', "phototaxis", stimuli=stimuli, t_stimuli=t_stimuli, shaders=[], python_file=__file__) # shared = Shared(r'D:\hanna_free_swimming_4fish_data', "hanna_phototaxis", stimuli=stimuli, t_stimuli=t_stimuli, # shaders=[dot_motion_shader, phototaxis_shader], python_file=__file__) shared.start_threads() class World(Scene): def __init__(self): # Init the scene Scene.__init__(self, shared=shared) # Place cards on the fishnodes cm = CardMaker('card')
def __init__(self): sd = Shared() self.__logger = sd.getLogger() self.__properties = {} self.__properties['CONFIG_FILE'] = 'config.json' self.__properties['mode'] = self.__getAttr( 'mode', 'train', self.__properties['CONFIG_FILE']) if self.__properties['mode'] == 'train': self.__properties['learning_rate'] = self.__getAttr( 'learning_rate', 1e-4, self.__properties['CONFIG_FILE']) self.__properties['max_round'] = self.__getAttr( 'max_round', 8e+3, self.__properties['CONFIG_FILE']) self.__properties['save_round'] = self.__getAttr( 'save_round', 100, self.__properties['CONFIG_FILE']) self.__properties['batch_n'] = self.__getAttr( 'batch_n', 1, self.__properties['CONFIG_FILE']) self.__properties['data_dir'] = self.__getAttr( 'train_data', 'data/train/', self.__properties['CONFIG_FILE']) self.__properties['loss_func'] = self.__getAttr( 'loss_func', 'l1', self.__properties['CONFIG_FILE']) else: assert (self.__properties['mode'] == 'infer') self.__properties['batch_n'] = self.__getAttr( 'batch_n', 1, self.__properties['CONFIG_FILE']) if self.__properties['batch_n'] != 1: self.__logger.error( 'batch_num must be [1] in [predict] mode,change current value [%d] to [1]!' % self.__properties['batch_n']) self.__properties['batch_n'] = 1 self.__properties['data_dir'] = self.__getAttr( 'test_data', 'data/test/', self.__properties['CONFIG_FILE']) self.__properties['conv_size'] = self.__getAttr( 'conv_size', 5, self.__properties['CONFIG_FILE']) self.__properties['graph_name'] = self.__getAttr( 'graph_name', 'model', self.__properties['CONFIG_FILE']) self.__properties['conf_input'] = self.__getAttr( 'conf_input', 'config.json', self.__properties['CONFIG_FILE']) self.__properties['ground_truth'] = self.__getAttr( 'ground_truth', 'truth.png', self.__properties['CONFIG_FILE']) self.__properties['cache_size'] = self.__getAttr( 'cache_size', 800, self.__properties['CONFIG_FILE']) self.__properties['batch_h'] = self.__getAttr( 'batch_h', 50, self.__properties['CONFIG_FILE']) self.__properties['batch_w'] = self.__getAttr( 'batch_w', 50, self.__properties['CONFIG_FILE']) self.__properties['log_file'] = self.__getAttr( 'log_file', 'run.log', self.__properties['CONFIG_FILE']) self.__properties['sfeatures'] = self.__getAttr( 'sfeatures', 8, self.__properties['CONFIG_FILE']) self.__properties['ifeatures'] = self.__getAttr( 'ifeatures', 2, self.__properties['CONFIG_FILE']) assert (self.__properties['ifeatures'] == 2) self.__properties['optimizer'] = self.__getAttr( 'optimizer', 'Adam', self.__properties['CONFIG_FILE']) self.__properties['model_path'] = self.__getAttr( 'model_path', 'data/model/', self.__properties['CONFIG_FILE']) self.__properties['ckpt_name'] = self.__getAttr( 'ckpt_name', 'model', self.__properties['CONFIG_FILE']) self.__properties['cnn_name'] = self.__getAttr( 'cnn_name', ['global', 'caustic'], self.__properties['CONFIG_FILE']) self.__properties['meta_name'] = self.__getAttr( 'meta_name', 'meta.json', self.__properties['CONFIG_FILE']) self.__properties['active_func'] = self.__getAttr( 'active_func', ['relu', 'sigmoid', 'relu', 'sigmoid'], self.__properties['CONFIG_FILE']) self.__properties['weights_shape'] = self.__getAttr( 'weights_shape', [8, 100, 100, 100, 121], self.__properties['CONFIG_FILE']) assert (len(self.__properties['active_func']) + 1 == len( self.__properties['weights_shape'])) # 图像通道,默认为3 self.__properties['cols'] = self.__getAttr( 'cols', 3, self.__properties['CONFIG_FILE']) self.__properties['plot_height'] = self.__getAttr( 'plot_height', 300, self.__properties['CONFIG_FILE']) self.__properties['plot_width'] = self.__getAttr( 'plot_width', 100, self.__properties['CONFIG_FILE']) self.__properties['session'] = None self.__properties['cache'] = Cache(self.queryAttr('cache_size'))