Skip to content

Instantly share code, notes, and snippets.

View shnhrtkyk's full-sized avatar
🏠
Working from home

teddy shnhrtkyk

🏠
Working from home
View GitHub Profile
@shnhrtkyk
shnhrtkyk / model.py
Created May 26, 2023 01:59
FWNet architecture using pytorch
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 08:04:29 2019
@author: shino
"""
from __future__ import print_function
import torch
import torch.nn as nn
@shnhrtkyk
shnhrtkyk / plink.bat
Created March 5, 2020 05:11
plinkを使ったUbuntuマシンへのコマンド送信
@shnhrtkyk
shnhrtkyk / pscp.bat
Created March 5, 2020 05:09
pscpでWin - Ubuntu間のファイル移動
psscp.exe -r -pw PASSWORD /local/path/data user@IPadress:/path/to/dir/
@shnhrtkyk
shnhrtkyk / main.cpp
Created February 18, 2020 08:26
Pytorch C++ APIのメイン
#include <torch/script.h> // One-stop header.
#include <iostream>
#include <memory>
#include <ATen/ATen.h>
#include "PytorchModel.h"
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
@shnhrtkyk
shnhrtkyk / PytorchModel.h
Created February 18, 2020 08:25
Pytorch C++ APIのやつ
#pragma once
#include <torch/script.h> // One-stop header.
#include <iostream>
#include <memory>
#include <ATen/ATen.h>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
@shnhrtkyk
shnhrtkyk / PytorchModel.cpp
Created February 18, 2020 08:23
Pytorch C++ API のやつ
#include <iostream>
#include "PytorchModel.h"
PytorchModel::PytorchModel()
{
}
/**
@shnhrtkyk
shnhrtkyk / JIT_compile.py
Last active February 18, 2020 08:18
pytorchのモデルをJITでコンパイル
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from models import modelName
import numpy as np
import cv2
@shnhrtkyk
shnhrtkyk / read_bin.py
Created February 8, 2020 08:33
pythonでバイナリを読む
# -*- coding: utf-8 -*-
"""
@author: shnhrtkyk
"""
path = "path/to/bin"
with open(path, mode='rb') as fin:
content = fin.read()
# print(content)
@shnhrtkyk
shnhrtkyk / loss.py
Created January 23, 2020 05:36
重み付きloss
def loss(labels, logits):
weights = tf.where(labels == 0, 1, 1)
weights = tf.where(labels == 1, 1, weights)
weights = tf.where(labels == 2, 2, weights)
weights = tf.where(labels == 3, 20, weights)
weights = tf.where(labels == 4, 20, weights)
weights = tf.where(labels == 5, 20, weights)
@shnhrtkyk
shnhrtkyk / job_pytorch.sh
Created January 17, 2020 23:03
TSUBAMEでpytorch
#!/bin/sh
#$ -cwd
#$ -l q_node=1
#$ -l h_rt=24:00:00
. /etc/profile.d/modules.sh