CompressAI Pytorch Lightning example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Repair ModelNet40. | |
Some of the files in ModelNet40 are broken, e.g., | |
.. code-block:: bash | |
$ head -n 1 ModelNet40/chair/train/chair_0856.off | |
OFF6586 5534 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"0": "0", | |
"1": "1", | |
"2": "2", | |
"3": "3", | |
"4": "4", | |
"5": "5", | |
"6": "6", | |
"7": "7", | |
"8": "8", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Download and extract the Vimeo90k dataset first: | |
mkdir -p vimeo90k | |
cd vimeo90k | |
wget http://data.csail.mit.edu/tofu/dataset/vimeo_triplet.zip | |
unzip vimeo_triplet.zip | |
wget http://data.csail.mit.edu/tofu/dataset/vimeo_septuplet.zip | |
unzip vimeo_septuplet.zip | |
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AccessModifierOffset: -2 | |
AlignAfterOpenBracket: BlockIndent # New in v14. For earlier clang-format versions, use AlwaysBreak instead. | |
AlignConsecutiveMacros: false | |
AlignConsecutiveAssignments: false | |
AlignConsecutiveDeclarations: false | |
AlignEscapedNewlines: DontAlign | |
AlignOperands: false | |
AlignTrailingComments: false | |
AllowAllArgumentsOnNextLine: false | |
AllowAllConstructorInitializersOnNextLine: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example.py | |
from common import setup | |
import torch.nn.functional as F | |
args, model, data_module = setup() | |
test_data_loader = data_module.test_dataloader() | |
for batch in iter(test_data_loader): | |
inputs, targets = batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numba | |
@numba.jit(nopython=True) | |
def estimate_flow_blockmatching(prev_img, next_img, block_size, search_window): | |
"""Estimate motion vectors using block matching. | |
Args: | |
prev_img: previous frame |