Skip to main content

Hello, I am Hao Vy Phan. I have develop this package using ResNet-50 to convert a video into an extracted i3D features numpy file.

Update: * Version 0.3.2: Fix bug of searching for video files. Now it looks for extensions .webm, .avi, .wmv, .mp4, .m4v, .m4p inside folder datasetpath.

* Version 0.3.1.1: The function can receive directly the path to just 1 video, if multiplefiles is set False.

Overview

Input: a directory which store 1 or more videos.

Output: 1 or many .npy files (extracted i3D features). Each features file is shaped n/16 * 2048 where n is the number of frames in the video

If there is a problem installing or implementing this package, please do not hesitate to contact me via my email. I am pleased to have people use my product.


Usage

Installation

(python3.8) Before installing my package, please install these pakages:

pip install torchvision-0.11.2+cu113-cp38-cp38-win_amd64.whl
pip install torchaudio-0.10.1+cu113-cp38-cp38-win_amd64.whl
pip install torch-1.10.1+cu113-cp38-cp38-win_amd64.whl
pip install opencv_python-4.5.5-cp38-cp38-win_amd64.whl

You can find the wheels here: https://download.pytorch.org/whl/cu113/torch_stable.html * Opencv-Python==4.5.5

* torch==1.10.1+cu113

* torchaudio==0.10.1+cu113

* torchvision==0.11.2+cu113

After 4 above packages, to install i3dFeatureExtraction package into your Python environment, run this code on your terminal:

pip install i3dFeatureExtraction

Implementing

The main function of this package is FeatureExtraction which converts a directory of videos into numpy feature files.

from i3dFeatureExtraction import FeatureExtraction
FeatureExtraction.generate(
    datasetpath="directory/of/input/videos",
    outputpath = "directory/to/store/output/numpy/files",
    pretrainedpath = "path/to/i3D/pretrained/weight",
    sample_mode = "oversample/center_crop"
    multiplefiles = True/False
)
  • datasetpath (REQUIRED): path to videos.

  • If multiplefiles is True (default), the datasetpath is the path to a directory which contains 1 or more videos.

  • If multiplefiles is False, the datasetpath is the path to a video.

  • outputpath (optional, default: “output/”): the proccessed numpy feature files would be stored in this directory.

  • pretrainedpath (optional, default: “pretrained/”): the path of the pretrained i3d weight. If the weight is not existed, it will be downloaded and created manually.

  • sample_mode (optional, default: “oversample/”) receive “oversample” or “center_crop”. If oversample, each frame will be cropped and flipped to be turned into 10 frames.


Structure of this package

I am not good at drawing UML diagram but I hope this image helps illustrate the package’s structure.

i3dFeatureExtraction - UML Diagram

Credits

This code is based on the following repositories:

* pytorch-resnet3d

* pytorch-i3d-feature-extraction

* E2E-Action-Segmentation/feature_extraction/

I would like to extend a special thank-you to the original authors of these repositories for providing the foundation on which this implementation is built.

Metadata

Release files for i3dFeatureExtraction 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for i3dFeatureExtraction 0.3.3
File Size Uploaded
i3dFeatureExtraction-0.3.3.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for i3dFeatureExtraction 0.3.3
File Interpreter ABI Platform
i3dFeatureExtraction-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / i3dFeatureExtraction-0.3.3.tar.gz

Download URL i3dFeatureExtraction-0.3.3.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bffc703af2816356bf32eb23e23d428eeaca1ca240b30478f40d208cead792eb
BLAKE2b-256 checksum
How to use checksums
a24d9a6ebe0d9608c6a9755a640aec256d12b102ffbe403552867bdb52cfd454
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / i3dFeatureExtraction-0.3.3-py3-none-any.whl

Download URL i3dFeatureExtraction-0.3.3-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46cdb9f88c66916d0105d9bb5e31f73f4a5c9b11a1207a434b42678726ffe3b6
BLAKE2b-256 checksum
How to use checksums
426d46d686a41b9410a234fef384f056b64ea206856cd1fb6110ef78c3716419
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page