Python 썸네일형 리스트형 Plotly를 이용한 multiple images 출력 import plotly.express as pxfrom plotly.subplots import make_subplotsimport plotly.graph_objects as go# Create a 2x2 subplot layoutfig = make_subplots(rows=2, cols=2)# Add each image as a heatmapfig.add_trace(go.Heatmap(z=label.squeeze().detach().to('cpu').numpy(), colorscale='gray', showscale=False), row=1, col=1)fig.add_trace(go.Heatmap(z=prediction.squeeze().detach().to.. 더보기 Rendering a 3D scene given 3D coordinate points using open3D import open3d as o3dimport numpy as np# Function to create a vehicle bounding boxdef create_vehicle_bbox(center, size, color=[0, 0, 1]): """Create a vehicle bounding box in Open3D.""" bbox = o3d.geometry.OrientedBoundingBox(center=center, R=np.eye(3), extent=size) bbox.color = color # Blue for vehicles return bbox# Function to create road lines (HD map elements)def create_map_lines(.. 더보기 Install a conda environment compatible with 'Resnoise' 0. install miniconda1. create conda env$ conda create -y -n resnoise python=3.82. activate created env$ source activate cvt3. install pytorch lightening through pip$ pip install pytorch-lightening==1.9.0 4. Reinstall pytorch, torchvision, cuda toolkit$ pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 https://download.pytorch.org/w.. 더보기 3D points data scatter plot import pickle# Load tensor from the filewith open('tensor.pkl', 'rb') as f: loaded_tensor = pickle.load(f)grids = loaded_tensor[0] # num_cams x num_depth x H x W x 3grids = grids.view(-1, 3).to('cpu').numpy()import plotly.graph_objects as go# Sample data: sequence of 3D points (x, y, z)x_points = list(grids[:, 0])y_points = list(grids[:, 1])z_points = list(grids[:, 2])# Create a 3D scatter pl.. 더보기 Scatter plot with subfigures with open('attn_result.pickle', 'rb') as fr: attn_result = pickle.load(fr) ref_cam = 'cam0' # tgt_cam_num = 3 image_ref = attn_result['cam0']['image'] # image_tgt = attn_result['cam'+str(tgt_cam_num)]['image'] Hh, Wh = image_ref.shape[:2] # Hl Wl nhead ncam npts 2 position = attn_result['cam0']['sample_position'] weight = attn_result['cam0']['attention_weight'] Hl, Wl = position.shape[:2] scale_.. 더보기 현재 모델의 state_dict()가 갖는 key값만 저장된 state_dict()로 부터 불러오기 pretrained_dict = {k: v for k, v in checkpoint['scratch_state_dict'].items() if k in self.scratch.state_dict()} self.scratch.load_state_dict(pretrained_dict) 더보기 PIL.image 라이브러리 사용법 1. Image Open from PIL import Image img = Image.open('./test.png') 2. Image Show img.show() 3. Image Characteristic img.filename # './test.png' img.formate # 'JPEG' img.size # (400, 400) img.mode # 'RGB' img.width # 400 img.height # 400 4. 이미지 크기 변경 resize_img = img.resize((WIDTH, HEIGHT), Image.NEAREST) resize_img = img.resize((WIDTH, HEIGHT), Image.BILINEAR) resize_img = img.resize((WIDTH, HEI.. 더보기 Change working directory to current location abspath = os.path.dirname(os.path.realpath(__file__)) os.chdir(Path(abspath).absolute()) 더보기 nuScenes 데이터셋의 이해 from nuscenes.nuscenes import NuScenes nusc = NuScenes(version='v1.0-trainval', dataroot=dataroot, verbose=True) 1. Scene nuScenes는 20초 가량 길이의 scene이 1000개가 존재. 이 중 850개만을 공개. # load first scene my_scene = nusc.scene[0] 2. Sample scene에는 여러개의 sample이 존재. 하나의 sample이 특정 시각에 수집된 각종 데이터 (camera, lidar, radar 등)를 의미. nuScene은 annotation을 2Hz로 했으므로, 두 sample 사이의 시간차는 약 0.5초 이며 하나의 scene에는 약 40개의 samp.. 더보기 [matplotlib] Creating multiple figures in one plot # Vertical fig, axs = plt.subplots(2) fig.suptitle('Vertically stacked subplots') axs[0].plot(x, y) axs[1].plot(x, -y) # Horizontal fig, (ax1, ax2) = plt.subplots(2) fig.suptitle('Vertically stacked subplots') ax1.plot(x, y) ax2.plot(x, -y) 더보기 이전 1 2 3 4 다음