Esempio n. 1
0
 def init_data_providers(self):
     class Dummy:
         def advance_batch(self):
             pass
     if self.need_gpu:
         ConvNetRunner.init_data_providers(self)
     else:
         self.train_data_provider = self.test_data_provider = Dummy()
Esempio n. 2
0
    def init_data_providers(self):
        class Dummy:
            def advance_batch(self):
                pass

        if self.need_gpu:
            ConvNetRunner.init_data_providers(self)
        else:
            self.train_data_provider = self.test_data_provider = Dummy()
Esempio n. 3
0
 def get_options_parser(cls):
     op = ConvNetRunner.get_options_parser()
     for option in list(op.options):
         if option not in ('gpu', 'load_file', 'train_batch_range', 'test_batch_range'):
             op.delete_option(option)
     op.add_option("show-cost", "show_cost", StringOptionParser, "Show specified objective function", default="")
     op.add_option("show-filters", "show_filters", StringOptionParser, "Show learned filters in specified layer", default="")
     op.add_option("input-idx", "input_idx", IntegerOptionParser, "Input index for layer given to --show-filters", default=0)
     op.add_option("cost-idx", "cost_idx", IntegerOptionParser, "Cost function return value index for --show-cost", default=0)
     op.add_option("no-rgb", "no_rgb", BooleanOptionParser, "Don't combine filter channels into RGB in layer given to --show-filters", default=False)
     op.add_option("yuv-to-rgb", "yuv_to_rgb", BooleanOptionParser, "Convert RGB filters to YUV in layer given to --show-filters", default=False)
     op.add_option("channels", "channels", IntegerOptionParser, "Number of channels in layer given to --show-filters (fully-connected layers only)", default=0)
     op.add_option("show-preds", "show_preds", StringOptionParser, "Show predictions made by given softmax on test set", default="")
     op.add_option("only-errors", "only_errors", BooleanOptionParser, "Show only mistaken predictions (to be used with --show-preds)", default=False, requires=['show_preds'])
     op.add_option("write-features", "write_features", StringOptionParser, "Write test data features from given layer", default="", requires=['feature-path'])
     op.add_option("feature-path", "feature_path", StringOptionParser, "Write test data features to this path (to be used with --write-features)", default="")
     
     op.options['load_file'].default = None
     return op
Esempio n. 4
0
 def init_model_lib(self):
     if self.need_gpu:
         ConvNetRunner.init_model_lib(self)
Esempio n. 5
0
 def import_model(self):
     if self.need_gpu:
         ConvNetRunner.import_model(self)
Esempio n. 6
0
 def get_gpus(self):
     self.need_gpu = self.op.get_value('show_preds') or self.op.get_value('write_features')
     if self.need_gpu:
         ConvNetRunner.get_gpus(self)
Esempio n. 7
0
 def __init__(self, op, load_dic):
     ConvNetRunner.__init__(self, op, load_dic)
Esempio n. 8
0
 def init_model_lib(self):
     if self.need_gpu:
         ConvNetRunner.init_model_lib(self)
Esempio n. 9
0
 def import_model(self):
     if self.need_gpu:
         ConvNetRunner.import_model(self)
Esempio n. 10
0
 def get_gpus(self):
     self.need_gpu = self.op.get_value('show_preds') or self.op.get_value(
         'write_features')
     if self.need_gpu:
         ConvNetRunner.get_gpus(self)
Esempio n. 11
0
 def __init__(self, op, load_dic):
     ConvNetRunner.__init__(self, op, load_dic)
Esempio n. 12
0
    def get_options_parser(cls):
        op = ConvNetRunner.get_options_parser()
        for option in list(op.options):
            if option not in ('gpu', 'load_file', 'train_batch_range',
                              'test_batch_range'):
                op.delete_option(option)
        op.add_option("show-cost",
                      "show_cost",
                      StringOptionParser,
                      "Show specified objective function",
                      default="")
        op.add_option("show-filters",
                      "show_filters",
                      StringOptionParser,
                      "Show learned filters in specified layer",
                      default="")
        op.add_option("input-idx",
                      "input_idx",
                      IntegerOptionParser,
                      "Input index for layer given to --show-filters",
                      default=0)
        op.add_option("cost-idx",
                      "cost_idx",
                      IntegerOptionParser,
                      "Cost function return value index for --show-cost",
                      default=0)
        op.add_option(
            "no-rgb",
            "no_rgb",
            BooleanOptionParser,
            "Don't combine filter channels into RGB in layer given to --show-filters",
            default=False)
        op.add_option(
            "yuv-to-rgb",
            "yuv_to_rgb",
            BooleanOptionParser,
            "Convert RGB filters to YUV in layer given to --show-filters",
            default=False)
        op.add_option(
            "channels",
            "channels",
            IntegerOptionParser,
            "Number of channels in layer given to --show-filters (fully-connected layers only)",
            default=0)
        op.add_option("show-preds",
                      "show_preds",
                      StringOptionParser,
                      "Show predictions made by given softmax on test set",
                      default="")
        op.add_option(
            "only-errors",
            "only_errors",
            BooleanOptionParser,
            "Show only mistaken predictions (to be used with --show-preds)",
            default=False,
            requires=['show_preds'])
        op.add_option("write-features",
                      "write_features",
                      StringOptionParser,
                      "Write test data features from given layer",
                      default="",
                      requires=['feature-path'])
        op.add_option(
            "feature-path",
            "feature_path",
            StringOptionParser,
            "Write test data features to this path (to be used with --write-features)",
            default="")

        op.options['load_file'].default = None
        return op