Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions 11_3d_to_2d/calib.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ P2: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 4.485728000000e+01
P3: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 -3.395242000000e+02 0.000000000000e+00 7.215377000000e+02 1.728540000000e+02 2.199936000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 2.729905000000e-03
R0_rect: 9.999239000000e-01 9.837760000000e-03 -7.445048000000e-03 -9.869795000000e-03 9.999421000000e-01 -4.278459000000e-03 7.402527000000e-03 4.351614000000e-03 9.999631000000e-01
Tr_velo_to_cam: 7.533745000000e-03 -9.999714000000e-01 -6.166020000000e-04 -4.069766000000e-03 1.480249000000e-02 7.280733000000e-04 -9.998902000000e-01 -7.631618000000e-02 9.998621000000e-01 7.523790000000e-03 1.480755000000e-02 -2.717806000000e-01
Tr_imu_to_velo: 9.999976000000e-01 7.553071000000e-04 -2.035826000000e-03 -8.086759000000e-01 -7.854027000000e-04 9.998898000000e-01 -1.482298000000e-02 3.195559000000e-01 2.024406000000e-03 1.482454000000e-02 9.998881000000e-01 -7.997231000000e-01

Tr_imu_to_velo: 9.999976000000e-01 7.553071000000e-04 -2.035826000000e-03 -8.086759000000e-01 -7.854027000000e-04 9.998898000000e-01 -1.482298000000e-02 3.195559000000e-01 2.024406000000e-03 1.482454000000e-02 9.998881000000e-01 -7.997231000000e-01
251 changes: 251 additions & 0 deletions 11_3d_to_2d/submissions/yang5493.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 76,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"?import matplotlib.pyplot as plt\n",
"import matplotlib.image as mpimg\n",
"import cv2\n",
"\n",
"import plotly.express as px\n",
"import plotly.graph_objects as go\n",
"\n",
"#import imageio\n"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(123254, 4)\n"
]
}
],
"source": [
"X1 = np.fromfile(\"/Users/yutingyang/github/PerceptionTutorials/11_3d_to_2d/velo.bin\", dtype=np.float32)\n",
"\n",
"X1 = X1.reshape((-1,4))\n",
"X1 = X1[:,:-1]\n",
"\n",
"one_c = np.ones(X1.shape[0])\n",
"X1 = np.c_[X1,one_c]\n",
"#print(X1.shape)"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [],
"source": [
"#im = imageio.imread('/Users/yutingyang/github/PerceptionTutorials/11_3d_to_2d/image.png')\n",
"#img = cv2.imread('/Users/yutingyang/github/PerceptionTutorials/11_3d_to_2d/image.png')\n",
"#cv2.imshow('image', img)\n",
"\n",
"im = plt.imread('/Users/yutingyang/github/PerceptionTutorials/11_3d_to_2d/image.png')\n",
"#plt.imshow(img)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"13\n",
"13\n",
"13\n",
"13\n",
"10\n",
"13\n",
"13\n",
"(3, 4)\n",
"(3, 3)\n"
]
}
],
"source": [
"Tr_velo_to_cam_list = []\n",
"R0_rect_list = []\n",
"P2_list = []\n",
"with open('/Users/yutingyang/github/PerceptionTutorials/11_3d_to_2d/calib.txt') as f:\n",
" for line in f:\n",
" lines = line.split() \n",
" print(len(lines))\n",
" if lines[0]=='Tr_velo_to_cam:':\n",
" Tr_velo_to_cam_list.append([float(i) for i in lines[1:]])\n",
" elif lines[0]=='R0_rect:':\n",
" R0_rect_list.append([float(i) for i in lines[1:]])\n",
" elif lines[0]=='P2:':\n",
" P2_list.append([float(i) for i in lines[1:]])\n",
"\n",
"Tr_velo_to_cam = np.array(Tr_velo_to_cam_list).reshape([3,4])\n",
"R0_rect = np.array(R0_rect_list).reshape([3,3])\n",
"P2 = np.array(P2_list).reshape([3,4])\n",
"print(P2.shape)\n",
"print(R0_rect.shape)"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(4, 4)\n",
"(4, 4)\n"
]
}
],
"source": [
"a = np.array([0,0,0,1]).reshape([1,4])\n",
"Tr_velo_to_cam = np.concatenate((Tr_velo_to_cam,a), axis=0)\n",
"P2 = np.concatenate((P2,a), axis=0)\n",
"\n",
"print(Tr_velo_to_cam.shape)\n",
"print(P2.shape)"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(4, 4)\n"
]
}
],
"source": [
"R0_rect = np.pad(R0_rect,((0, 1), (0, 1)), 'constant')\n",
"R0_rect[3,3]=1\n",
"R0_rect\n",
"\n",
"print(R0_rect.shape)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(123254, 3)"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" #X3 = P2 @ R0_rect @ Tr_velo_to_cam @ X1.\n",
"X3 = P2 @ R0_rect @ Tr_velo_to_cam @ np.transpose(X1)\n",
"X3 = np.transpose(X3)\n",
"X3 = X3[:,:-1]\n",
"X3.shape"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[45344.58603843 11394.94659141 74.38710999]\n",
"[609.57585315 153.18442392 74.38710999]\n"
]
}
],
"source": [
"print(X3[0,:])\n",
"for x3 in X3:\n",
" x3[0] = x3[0]/x3[2]\n",
" x3[1] = x3[1]/x3[2]\n",
" \n",
"print(X3[0,:])"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "'numpy.ndarray' object has no attribute 'height'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn [78], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m px \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;241m/\u001b[39m plt\u001b[38;5;241m.\u001b[39mrcParams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfigure.dpi\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;66;03m# pixel in inches\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m h, w \u001b[38;5;241m=\u001b[39m \u001b[43mim\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheight\u001b[49m, im\u001b[38;5;241m.\u001b[39mwidth\n\u001b[1;32m 3\u001b[0m fig, ax \u001b[38;5;241m=\u001b[39m plt\u001b[38;5;241m.\u001b[39msubplots(\u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m1\u001b[39m, figsize\u001b[38;5;241m=\u001b[39m(w\u001b[38;5;241m*\u001b[39mpx, h\u001b[38;5;241m*\u001b[39mpx))\n\u001b[1;32m 4\u001b[0m ax\u001b[38;5;241m.\u001b[39mset_xlim([\u001b[38;5;241m0\u001b[39m, w])\n",
"\u001b[0;31mAttributeError\u001b[0m: 'numpy.ndarray' object has no attribute 'height'"
]
}
],
"source": [
"px = 1 / plt.rcParams['figure.dpi'] # pixel in inches\n",
"h, w = im.height, im.width\n",
"fig, ax = plt.subplots(1, 1, figsize=(w*px, h*px))\n",
"ax.set_xlim([0, w])\n",
"ax.set_ylim([h, 0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"vscode": {
"interpreter": {
"hash": "0553d48d5c947e80eaca19108a322f30dc3a6eb9ae7718d5446cffded678c620"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
30 changes: 30 additions & 0 deletions 12_remote_server/submissions/yang.5493
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda/10.2.89'
--------------------- ------------------------------------------------------------------------------------
sys.platform linux
Python 3.7.10 (default, Jun 4 2021, 14:48:32) [GCC 7.5.0]
numpy 1.21.6
detectron2 0.6 @/users/PAS2119/yang5493/detectron2/detectron2
Compiler GCC 8.4
CUDA compiler not available
DETECTRON2_ENV_MODULE <not set>
PyTorch 1.12.1+cu102 @/users/PAS2119/yang5493/.local/lib/python3.7/site-packages/torch
PyTorch debug build False
GPU available No: torch.cuda.is_available() == False
Pillow 9.2.0
torchvision 0.13.1+cu102 @/users/PAS2119/yang5493/.local/lib/python3.7/site-packages/torchvision
fvcore 0.1.5.post20220512
iopath 0.1.9
cv2 Not found
--------------------- ------------------------------------------------------------------------------------
PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -fabi-version=11 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.12.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF,

yang.5493 says this is on local.