Skip to content

Instantly share code, notes, and snippets.

View trungnt13's full-sized avatar
:octocat:
Coding, coding, ... and still coding

TrungNT trungnt13

:octocat:
Coding, coding, ... and still coding
View GitHub Profile
@trungnt13
trungnt13 / midas_loss.py
Created June 12, 2022 20:08 — forked from dvdhfnr/midas_loss.py
Loss function of MiDaS
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))
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF)
# https://github.com/apache/tvm/tree/main/docker/install
. /etc/profile
set -o errexit -o nounset
set -o pipefail
ANDROID_HOME=/opt/android-sdk-linux
@trungnt13
trungnt13 / coconerd.json
Last active August 16, 2021 10:49
Coverage Badge
{"schemaVersion":1,"label":"Coverage","message":"79%","color":"yellow"}
@trungnt13
trungnt13 / voxceleb_f0.txt
Created October 27, 2020 18:33
Extracted F0 from Voxceleb dataset with gender labels
ID10001 m 112.3214
ID10002 m 140.6493
ID10003 m 146.4722
ID10004 m 120.6954
ID10005 m 150.4191
ID10006 f 165.4478
ID10007 f 270.6876
ID10008 f 225.5818
ID10009 m 200.2969
ID10010 m 102.2391
@trungnt13
trungnt13 / conda_initialize.sh
Created December 15, 2019 02:59
Bash initialization for Miniconda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/trung/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/trung/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/trung/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/trung/miniconda3/bin:$PATH"
@trungnt13
trungnt13 / DL_UEF19_Tut1.py
Last active November 15, 2019 14:00
First tutorial for Deep Learning course at UEF 2019
from __future__ import absolute_import, division, print_function
import os
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from tensorflow import keras
from __future__ import print_function, division, absolute_import
import tensorflow as tf
tf.enable_eager_execution()
from tensorflow_probability.python.distributions import NegativeBinomial
from zero_inflated import ZeroInflated
nb = NegativeBinomial(total_count=10, probs=0.5)
zfnb = ZeroInflated(dist=nb, pi=0.9)
WC Classic Rock 1 6kN 16g 7/13.0mm
WC Classic Rock 2 10kN 25g 8.2/13.8mm
WC Classic Rock 3 10kN 28g 9.6/14.5mm
WC Classic Rock 4 10kN 30g 11.3/15.3mm
WC Classic Rock 5 10kN 32g 13.3/16.8mm
WC Classic Rock 6 10kN 36g 15.6/19.0mm
WC Classic Rock 7 10kN 38g 18.4/21.2mm
WC Classic Rock 8 12kN 47g 21.6/24.0mm
WC Classic Rock 9 12kN 60g 24.4/27.7mm
WC Classic Rock 10 12kN 71g 30.0/31.0mm
Camalot X4 Red 0.1 5kN 51g 8.4-13.8mm
Camalot X4 Yellow 0.2 6kN 54g 9.9-16.5mm
Camalot X4 Blue 0.3 8kN 75g 12.4-21.2mm
Camalot X4 Grey 0.4 9kN 82g 15.5-26.6mm
Camalot X4 Purple 0.5 9kN 91g 19.8-33.7mm
Camalot X4 Green 0.75 9kN 112g 24-41.2mm
Camalot C3 Grey 000 4kN 55g 7.8-12.9mm
Camalot C3 Purple 00 6kN 57g 9.0-13.7mm
Camalot C3 Green 0 7kN 59g 10.7-15.8mm