This file contains hidden or 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
def trimmed_mae_loss(prediction, target, mask, trim=0.2): | |
M = torch.sum(mask, (1, 2)) | |
res = prediction - target | |
res = res[mask.bool()].abs() | |
trimmed, _ = torch.sort(res.view(-1), descending=False)[ | |
: int(len(res) * (1.0 - trim)) | |
] |
This file contains hidden or 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 | |
def compute_scale_and_shift(prediction, target, mask): | |
# system matrix: A = [[a_00, a_01], [a_10, a_11]] | |
a_00 = torch.sum(mask * prediction * prediction, (1, 2)) | |
a_01 = torch.sum(mask * prediction, (1, 2)) | |
a_11 = torch.sum(mask, (1, 2)) |
This file contains hidden or 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
@ECHO OFF | |
rem usage: transcodemvc input output [-r] [-s] | |
rem -r will re-use a previously extracted elementary stream from the temp file location | |
rem -s will swap eyes | |
set TEMP_DIR=c:\temp\recodemvc | |
set TEMP_FILE=%TEMP_DIR%\temp_mvc.264 | |
set PROFILE=high | |
set SWAP=false |