def add_webcam(self, webcam_id): """ Create the required files and directories for a new webcam """ logger.info("Creating webcam %s on file system", webcam_id) # create pytables files hdf5_path = self.dataset_path(webcam_id) w, h = settings.WEBCAM_SIZE img_shape = h, w, 3 w, h = settings.DEFAULT_FEATURES_SIZE feat_shape = h, w, 3 with ImageSet.create(hdf5_path, img_shape) as imageset: extractor = RawFeatures(feat_shape, img_shape) imageset.add_feature_set(extractor) DataSet.create(imageset).close() # create directories for pictures pics_path = self.fs.path(self.picture_path(webcam_id)) os.makedirs(pics_path)
def open_dataset(self, webcam_id): hdf5_path = self.dataset_path(webcam_id) return DataSet.open(hdf5_path)
def dataset(bigimageset): dataset = DataSet.create(bigimageset) intervals = [60] * 4 + [120] feat_set = bigimageset.feature_sets.keys()[0] dataset.make_set('test', intervals, feat_set) return dataset
def emptydataset(emptyimageset): dataset = DataSet.create(emptyimageset) return dataset
def __getitem__(self, key): dataset = self._cache.get(key) if dataset is None: dataset = DataSet.open(key) self._cache[key] = dataset return dataset