Introduction to fvcore
fvcore is a lightweight core library designed to cater to the essential needs shared by various computer vision frameworks. It is part of the suite of tools developed by FAIR, the Facebook AI Research team, and is prominently used in projects such as Detectron2, PySlowFast, and ClassyVision. The library ensures that all its components are type-annotated, rigorously tested, and benchmarked for performance.
Features of fvcore
fvcore offers a range of useful features and utilities that are indispensable for computer vision projects:
-
Common PyTorch Utilities: The library includes a variety of layers, functions, and loss modules for PyTorch in the
fvcore.nn
module. -
Flop Counting Tool: It provides a hierarchical method to calculate the floating-point operations (FLOPs) per operator, which is essential for performance evaluation. Detailed documentation can be found in the library's notes.
-
Parameter Counting: The library can recursively count parameters, aiding in assessing the complexity of models. There is a comprehensive API documentation available for this feature.
-
BatchNorm Statistics Recalculation: fvcore allows users to recompute the population statistics for Batch Normalization, which is particularly useful for model fine-tuning. This feature is also documented here.
-
Hyperparameter Scheduler: The library includes a stateless and scale-invariant hyperparameter scheduler, facilitating improved management of hyperparameters throughout the training process. More details can be found in its API documentation.
Installation Guide
To install fvcore, users need Python 3.6 or higher and PyTorch. There are several methods to install the library:
Installation from PyPI
The easiest way to install fvcore is through PyPI. This version is updated nightly:
pip install -U fvcore
Installation from Anaconda Cloud
Another option is via Anaconda Cloud, where it is also updated nightly:
conda install -c fvcore -c iopath -c conda-forge fvcore
Installation from GitHub
For those who prefer the latest development version, installation directly from GitHub is available:
pip install -U 'git+https://github.com/facebookresearch/fvcore'
Installation from a Local Clone
Finally, users can clone the repository and install it locally:
git clone https://github.com/facebookresearch/fvcore
pip install -e fvcore
Licensing
fvcore is released under the Apache 2.0 license, granting broad freedom to use, modify, and distribute the software, with relatively few restrictions.