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
# JET colormap | |
# See https://stackoverflow.com/questions/7706339/grayscale-to-red-green-blue-matlab-jet-color-scale | |
def _get_colormap_jet(x: Tensor) -> Tensor: | |
# x has value range [0, 1] | |
r = torch.clamp(1.5 - torch.abs(4 * x - 3.0), 0.0, 1.0) # -> [bs, 1, h, w] | |
g = torch.clamp(1.5 - torch.abs(4 * x - 2.0), 0.0, 1.0) # -> [bs, 1, h, w] | |
b = torch.clamp(1.5 - torch.abs(4 * x - 1.0), 0.0, 1.0) # -> [bs, 1, h, w] | |
return torch.cat((r, g, b), dim=1) # -> [bs, 3, h, w] |
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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
class NormalizedCrossCorrelation2d(nn.Module): | |
def __init__(self): | |
super(NormalizedCrossCorrelation2d, self).__init__() | |
def forward(self, x: torch.Tensor, template: torch.Tensor) -> torch.Tensor: | |
# Do image-wise normalization |
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
cmake .. \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_TOOLCHAIN_FILE=toolchain.cmake \ | |
-D CMAKE_BUILD_TYPE=RELEASE \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D CMAKE_INSTALL_PREFIX="/usr" \ | |
-D BUILD_opencv_python3=ON \ | |
-D BUILD_opencv_python2=OFF \ | |
-D CPU_BASELINE=NEON \ | |
-D OPENCV_ENABLE_NONFREE=OFF \ |
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
BasedOnStyle: LLVM | |
UseTab: Never | |
IndentWidth: 4 | |
DerivePointerAlignment: false | |
PointerAlignment: true | |
AlwaysBreakAfterReturnType: None | |
AlwaysBreakTemplateDeclarations: true | |
AlwaysBreakBeforeMultilineStrings: true | |
AlignOperands: true | |
AlignAfterOpenBracket: true |
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
export ARCH=armv7 | |
export CPU=armv7-a | |
export OS=linux | |
export TARGET=armv7-linux-gnueabihf | |
export SYSROOT=../sysroot | |
export PREFIX=/usr | |
export TOOLCHAIN=/usr/local/opt/llvm/bin | |
export CC=$TOOLCHAIN/clang | |
export CXX=$TOOLCHAIN/clang++ |