Skip to content

Instantly share code, notes, and snippets.

View yuki-inaho's full-sized avatar

yuki-inaho

View GitHub Profile
@yuki-inaho
yuki-inaho / np_class2one_hot.py
Last active June 8, 2021 07:19
categorical-labelled mask -> one-hot type expression
import numpy as np
def np_class2one_hot(category_array: np.ndarray, n_classes: int) -> np.ndarray:
res = np.eye(n_classes)[np.array(category_array).reshape(-1)]
return res.reshape(list(category_array.shape) + [n_classes])
@yuki-inaho
yuki-inaho / split_horizontal_concat_image.sh
Last active May 31, 2023 21:34
The script to split an image horizontally into equal parts with ffmpeg
#!/bin/bash
input_file="$1"
N="$2"
output_dir="${3:-.}"
# Get image width
width=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=p=0 "$input_file")
# Calculate width of each segment
#!/usr/bin/env python3
import argparse
import tkinter as tk
from tkinter import scrolledtext
def main(order_title_init, supplement_title_init):
# メインウィンドウの作成
root = tk.Tk()
root.title("Text Generator")
@yuki-inaho
yuki-inaho / extract_images_in_whitelist.sh
Created June 13, 2023 06:03
The shell script to extract images whose name is written in whitelist.txt
#!/bin/bash
# ファイルパス
whitelist_file="whitelist.txt"
raw_dir="input"
extracted_dir="extracted"
# extractedディレクトリが存在しない場合は作成する
if [ ! -d "$extracted_dir" ]; then
mkdir "$extracted_dir"
@yuki-inaho
yuki-inaho / point_cloud_viewer_o3d_wi_rotating_camera.py
Created September 5, 2024 03:26
Open3D Point Cloud 3D Visualization with Rotating Camera
import open3d as o3d
import numpy as np
import time
# 点群を生成
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(np.random.rand(1000, 3))
# ビジュアライザーの設定
vis = o3d.visualization.Visualizer()
@yuki-inaho
yuki-inaho / llm_agent_support_gui.py
Created December 5, 2025 07:22
llm_agent_support_gui.py
#!/usr/bin/env python3
import argparse
import tkinter as tk
from tkinter import scrolledtext
def main(order_title_init, supplement_title_init):
# メインウィンドウの作成
root = tk.Tk()
root.title("Text Generator")
font-family = "JetBrains Mono"
font-family = "Noto Sans CJK JP"
font-size = 15
font-feature = -dlig