Skip to content

Instantly share code, notes, and snippets.

@ferreirafabio
Last active April 21, 2020 04:39
Show Gist options
  • Save ferreirafabio/60323a87ba80c052ab272ff769149577 to your computer and use it in GitHub Desktop.
Save ferreirafabio/60323a87ba80c052ab272ff769149577 to your computer and use it in GitHub Desktop.
full example for executing the pipeline in the py-video-features package
from videofeatures import Pipeline, ActivityNetDataset, TwentyBNDataset, ResNetFeatures, SIFTFeatures, VGGFeatures, SURFFeatures
import configparser
_base_dir = "./output"
config = configparser.ConfigParser()
config.read('config.ini')
train_dir = config['GULP']['train_data_gulp']
valid_dir = config['GULP']['valid_data_gulp']
twentybn_train = ArmarDataset(batch_size=20, train_dir=train_dir, valid_dir=valid_dir).getDataLoader(train=True)
resnet = ResNetFeatures()
pipeline = Pipeline(dataset=twentybn_train, extractor=resnet, base_dir=_base_dir)
features, labels = pipeline.extractFeatures()
fisher_vector_gmm = pipeline.trainFisherVectorGMM(features)
fisher_vectors, labels = pipeline.computeFisherVectors(features=features, labels=labels, fv_gmm=fisher_vector_gmm)
@cto300
Copy link

cto300 commented Apr 21, 2020

Hi, I'm having some trouble gulping a custom dataset for extractor. Do you have an example on how to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment