Load a feature from disk.
541553
def get_feature(self, cat, img, feature):
        
        filename = self.path(cat, img, feature)
        data = loadmat(filename)
        name = [k for k in list(data.keys()) if not k.startswith('__')]
        if self.size is not None:
            return imresize(data[name.pop()], self.size)
        return data[name.pop()]
1273750
def load(filename, default=None):
    '''
    
    '''
    ext = get_ext(filename)
    if ext in ldict:
        return ldict[ext](filename)
    else:
        return default
230563
def load(self):
        """"""
        basepath = os.path.dirname(os.path.abspath(__file__))
        filename = os.sep.join([basepath, c.FOLDER_JSON, c.FILE_GAME_VERSIONS])
        Handler.ALL_VERS_DATA = {} # reset known data; do not retain defunct information
        with open(filename, "r") as f:
            data = json.loads( f.read() )
        self.update(data)
        self._updated = False
1124255
def load(self, size):
        """"""
        if self.exists() and self.isfile():
            return eval(open(self).read(size))
1355838
def load_features(self):
        
        # Loading all loci that
        # are in self.loci variable defined
        # when the pyGFE object is created
        for loc in self.loci:
            if self.verbose:
                self.logger.info(self.logname + "Loading features for " + loc)

            # Loading all features for loc from feature service
            self.all_feats.update({loc: self.locus_features(loc)})

            if self.verbose:
                self.logger.info(self.logname + "Finished loading features for " + loc)

        if self.verbose:
            mem = "{:4.4f}".format(sys.getsizeof(self.all_feats) / 1000000)
            self.logger.info(self.logname + "Finished loading all features * all_feats = " + mem + " MB *")
1289260
def _load( self, fn ):
        """"""

        # if file is empty, create an empty notebook
        if os.path.getsize(fn) == 0:
            self._description = None
            self._results = dict()
            self._pending = dict()
        else:
            # load the JSON object
            with open(fn, "r") as f:
                s = f.read()

                # parse back into appropriate variables
                j = json.loads(s)
                self._description = j['description']
                self._pending = dict(j['pending'])
                self._results = j['results']

                # perform any post-load patching
                self.patch()
193117
def _get_vqa_v2_image_feature_dataset(
    directory, feature_url, feature_filename="mscoco_feat.tar.gz"):
  """"""
  feature_file = generator_utils.maybe_download_from_drive(
      directory, feature_filename, feature_url)
  with tarfile.open(feature_file, "r:gz") as feature_tar:
    feature_tar.extractall(directory)
820519
def __load(self, path):
        """"""
        try:
            path = os.path.abspath(path)
            with open(path, 'rb') as df:
                # loaded_dataset = pickle.load(df)
                self.__data, self.__classes, self.__labels, \
                self.__dtype, self.__description, \
                self.__num_features, self.__feature_names = pickle.load(df)

            # ensure the loaded dataset is valid
            self.__validate(self.__data, self.__classes, self.__labels)

        except IOError as ioe:
            raise IOError('Unable to read the dataset from file: {}', format(ioe))
        except:
            raise
1303335
def load(self, filename, offset):
        """"""
        try:
            self.offset = offset
            # self.fd = open(filename, 'rb')
            # self.fd.close()
        except IOError as e:
            print(e)
545618
def main(feature_folder, create_learning_curve=False):
    """"""

    # Read the feature description file
    with open(os.path.join(feature_folder, "info.yml"), 'r') as ymlfile:
        feature_description = yaml.load(ymlfile)

    # Get preprocessed .pickle file from model description file
    path_to_data = os.path.join(utils.get_project_root(),
                                feature_description['data-source'])
    if os.path.isdir(path_to_data):
        path_to_data = os.path.join(path_to_data, "data.pickle")
    target_paths = {'traindata': os.path.join(feature_folder,
                                              "traindata.hdf5"),
                    'validdata': os.path.join(feature_folder,
                                              "validdata.hdf5"),
                    'testdata': os.path.join(feature_folder,
                                             "testdata.hdf5")}

    feature_list = features.get_features(feature_description['features'])
    mult_queue = data_multiplication.get_data_multiplication_queue(
        feature_description['data-multiplication'])

    # Set everything up for the creation of the 3 hdf5 (test, validation,
    # training).

    os.chdir(feature_folder)
    logging.info("Start creation of hdf5-files...")
    logging.info("Get sets from '%s' ...", path_to_data)
    (training_set, validation_set, test_set, formula_id2index,
     preprocessing_queue, index2latex) = get_sets(path_to_data)

    training_set = training_set_multiplication(training_set, mult_queue)
    _create_index_formula_lookup(formula_id2index, feature_folder, index2latex)

    # Output data for documentation
    print("Classes (nr of symbols): %i" % len(formula_id2index))
    preprocessing.print_preprocessing_list(preprocessing_queue)
    features.print_featurelist(feature_list)

    logging.info("Start creating hdf5 files")

    # Get the dimension of the feature vector
    input_features = sum(map(lambda n: n.get_dimension(), feature_list))

    # Traindata has to come first because of feature normalization
    for dataset_name, dataset, is_traindata in \
        [("traindata", training_set, True),
         ("testdata", test_set, False),
         ("validdata", validation_set, False)]:
        t0 = time.time()
        logging.info("Start preparing '%s' ...", dataset_name)
        prepared, translation = prepare_dataset(dataset,
                                                formula_id2index,
                                                feature_list,
                                                is_traindata)
        logging.info("%s length: %i", dataset_name, len(prepared))
        logging.info("start 'make_hdf5'x ...")
        make_hdf5(dataset_name,
                  input_features,
                  prepared,
                  os.path.join(feature_folder, target_paths[dataset_name]),
                  create_learning_curve)

        _create_translation_file(feature_folder,
                                 dataset_name,
                                 translation,
                                 formula_id2index)

        t1 = time.time() - t0
        logging.info("%s was written. Needed %0.2f seconds", dataset_name, t1)
        gc.collect()
    utils.create_run_logfile(feature_folder)
998575
def load(self):
        """"""

        with open(self.store_file_path, 'r') as fh:
            self.store = json.loads(fh.read())
307470
def load(self, filename):
        """"""
        content = open(filename)
        return Config(json.load(content))
1361981
def load_metadata(self, data_dir, feature_name=None):
    """"""
    # Restore names if defined
    names_filepath = _get_names_filepath(data_dir, feature_name)
    if tf.io.gfile.exists(names_filepath):
      self.names = _load_names_from_file(names_filepath)
1226619
def load_state_from_disk():
    
    if is_there_state():
        with open('data.json', 'r') as f:
            data = json.load(f)
        return data
    else:
        return False
177017
def feature_handler(self, cmd):
        """"""
        feature = cmd.feature_name
        if feature not in commands.FEATURE_NAMES:
            self.warning("feature %s is not supported - parsing may fail"
                % (feature,))
195610
def load(filename, **kwargs):
    
    with open(filename, 'rb') as f:
        reader = T7Reader(f, **kwargs)
        return reader.read_obj()
843697
def load_ext(self):
        """"""
        try:
            sequencemanager = hydpy.pub.sequencemanager
        except AttributeError:
            raise RuntimeError(
                'The time series of sequence %s cannot be loaded.  Firstly, '
                'you have to prepare `pub.sequencemanager` correctly.'
                % objecttools.devicephrase(self))
        sequencemanager.load_file(self)