Skip to content

Instantly share code, notes, and snippets.

@KyanainsGate
KyanainsGate / learn_tensor.py
Created December 1, 2022 22:11
Pytorch3d demonstration for tensor learning
"""
Python: 3.9.5
torch: 1.12.1+cu113
pytorch3d: 0.7.1
"""
import torch
from torch import nn
from pytorch3d.transforms.rotation_conversions import quaternion_to_matrix, matrix_to_quaternion
@KyanainsGate
KyanainsGate / setting_jetbot_4_3_jp.MD
Last active February 7, 2021 04:35
Jetson setup (japanese)

Setup for Jetbot (Jetpack 4.3)

What to be installed

  • Jetpack 4.3
    • SD card version is r32.3.1
    • Other lib versions (e.g. cuda, cuDNN, tensorrt...) showed in here
  • Japanese languages
  • ROS and so on

Minimul setup

  • Flash Jetbot images to SD card
def broadcast_1d_to_2dtile(x, h_and_w_list, name=None):
"""
Convert (Batch, dim) to the image like tensor, as (Batch, h, w, dim)
That function is used in "Neural Representation and rendering (S. M. Ali Eslami+ 2018 Science)"
to feed CNN "v" vector.
e.g.) x=[[1,2,3]] and batch_size=1 h_and_w_list=[2,2]
=> [[[1,1],[1,1]],[[2,2],[2,2]],[[3,3],[3,3]]]
:param x: A tensor, (Batch, dim)
:param h_and_w_list:A list of output image, shape is [h, w]
@KyanainsGate
KyanainsGate / softargmax_tf.py
Last active June 3, 2019 06:10
softargmax_tensorflow
def tf_softargmax(x, batch ,min=0., max=1.):
"""
"soft-argmax" is a differentiable version of "argmax" function [Kendall et al. 2017].
URL: https://arxiv.org/abs/1703.04309
First computes the softmax over the spatial extent of each channel of a convolutional feature map.
Then computes the expected 2D position of the points of maximal activation for each channel,
resulting in a set of feature keypoints (e.g. [[E[x1], E[y1]], [E[x2], E[y2]], ... ,E[xN], E[yN]])
in each channel and batch.
@KyanainsGate
KyanainsGate / sumatra-setting.md
Created January 23, 2018 03:27
latex sumatraの設定

SumatraPDFの設定

 エディタとの対応をとるために、SumatraPDFの設定をします。  SumatraPDFのメニューから「設定 -> オプション」を選択します。出た窓の「逆順検索コマンドラインの設定」に、以下のように入力します。

"C:\Program Files\Sublime Text 3\sublime_text.exe" "%f:%l"

一つ目のクオート内にはSublime Textの実行ファイルのパスを書きます。インストール時に場所を変えている場合は、それに沿って書いてください

@KyanainsGate
KyanainsGate / main.md
Last active December 26, 2017 05:15
[latex]: table of contents style setting (header)

source

\begin{document}
\pagestyle{empty}
\tableofcontents%目次のページ番号を削除したい
\clearpage%%%これをいれるのが重要.
%いれないと目次の最終ページがどうなるか見てましょう.
\pagestyle{plain}%%jreportのデフォルトのpagestyle
\setcounter{page}{1}%%これで,1章1ページ目が-1-に