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 / change_maxsize_pillow.py
Created September 8, 2019 22:25
Pillowの最大サイズ変更
Image.MAX_IMAGE_PIXELS=10000000000
@shnhrtkyk
shnhrtkyk / json2jpg.py
Last active October 4, 2019 12:10
Convert polygons to raster image
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 10:46:28 2019
@author: shino
"""
from shapely import wkt
import json
@shnhrtkyk
shnhrtkyk / json2gt.py
Created October 4, 2019 21:21
loop file list
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 10:46:28 2019
@author: shino
"""
from shapely import wkt
import json
gridopt = gdal.GridOptions(format='GTiff', algorithm='linear', width=1000,
height=1000)
dtm_data = gdal.Grid('tmp_point.tif', 'tmp_point.vrt', options=gridopt)
#!/bin/sh
#$ -c#!/bin/sh
#$ -cwd
#$ -l q_node=1
#$ -l h_rt=24:00:00
. /etc/profile.d/modules.sh
for file in `\find . -name '*.txt'`; do
echo $file
echo ${file##*/}
cut -f1,2,3,4 -d";" $file > ../train_pointtxt/${file##*/}
cut -f5- -d";" $file > ../train_wavetxt/${file##*/}
done
@shnhrtkyk
shnhrtkyk / txt2las.sh
Created December 27, 2019 19:41
macでtxt2las 一括
for file in `\find . -name '*.txt'`; do
echo $file
tonnage=${file##*/}
echo ${tonnage/.txt/.las}
/path/to/LAStools-master/bin/txt2las -i $file -o ../train_las/${tonnage/.txt/.las} -parse xyzc
done
@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
@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 / 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)