現在所有草圖三維重建的頂會paper都用到了shapenet(其實也就不到十篇),有必要學習一下,
目錄
ShapeNet簡介
binvox檔案格式
Python讀取示例
下載
ShapeNet簡介
ShapeNet是一個由物件的三維CAD模型表示的豐富注釋的,大規模的形狀存盤庫,ShapeNet包含來自多種語意類別的3D模型,并按照WordNet分類法組織它們,它是一組資料集,為每個3D模型提供許多語意標注,如一致的剛性對準、零件和雙邊對稱平面、物理尺寸、關鍵字以及其他計劃的標注,注釋通過基于web的公共介面提供,以支持物件屬性的資料可視化,促進資料驅動的幾何分析,并為計算機圖形學和視覺研究提供大規模定量基準,ShapeNet已經索引了超過300萬個模型,其中22萬個模型被分為3135個類別(WordNet synsets),
ShapeNetCore
ShapeNetCore是完整ShapeNet資料集的子集,具有單個干凈的3D模型以及手動驗證的類別和路線注釋,它涵蓋約55,300個獨特的3D模型和55個常見物件類別,ShapeNetCore涵蓋了流行的計算機視覺3D基準資料集PASCAL 3D +的12個物件類別,
ShapeNetSem
ShapeNetSem是一個較小的,注釋更密集的子集,由分布在270個類別中的12,000個模型組成,除了手動驗證的類別標簽和一致的對齊方式之外,這些模型還帶有實際尺寸,類別級別的材料成分估計以及總體積和總重量的注釋,
binvox檔案格式
binvox可讀取3D模型檔案,將其柵格化為二進制3D體素網格,然后寫入生成的體素檔案,以binvox格式存盤3D點云格式檔案,節約存盤空間
在線讀取器:https://raahii.github.io/simple_voxel_viewer/index.html

離線讀取軟體下載地址:https://www.patrickmin.com/viewvox/win/viewvox.exe?rnd=1612535001696693
Python讀取示例
import numpy as np
class Voxels(object):
def __init__(self, data, dims, translate, scale, axis_order):
self.data = data
self.dims = dims
self.translate = translate
self.scale = scale
# axis不是xyz坐標系的時候觸發例外
assert (axis_order in ('xzy', 'xyz'))
self.axis_order = axis_order
def read_as_3d_array(fp, fix_coords=True):
dims, translate, scale = read_header(fp)
raw_data = np.frombuffer(fp.read(), dtype=np.uint8)
# if just using reshape() on the raw data:
# indexing the array as array[i,j,k], the indices map into the
# coords as:
# i -> x
# j -> z
# k -> y
# if fix_coords is true, then data is rearranged so that
# mapping is
# i -> x
# j -> y
# k -> z
values, counts = raw_data[::2], raw_data[1::2]
data = np.repeat(values, counts).astype(np.bool)
data = data.reshape(dims)
if fix_coords:
# xzy to xyz TODO the right thing
data = np.transpose(data, (0, 2, 1))
axis_order = 'xyz'
else:
axis_order = 'xzy'
return Voxels(data, dims, translate, scale, axis_order)
def read_header(fp):
# 讀取binvox頭檔案
line = fp.readline().strip()
if not line.startswith(b'#binvox'):
raise IOError('Not a binvox file')
dims = list(map(int, fp.readline().strip().split(b' ')[1:]))
translate = list(map(float, fp.readline().strip().split(b' ')[1:]))
scale = list(map(float, fp.readline().strip().split(b' ')[1:]))[0]
line = fp.readline()
return dims, translate, scale
if __name__ == '__main__':
path = 'model.binvox'
with open(path, 'rb') as f:
model = read_as_3d_array(f)
# 尺寸(長寬高),轉化矩陣,放縮系數
print(model.dims, model.translate, model.scale)
print(model.data)
下載
官網的網速真的是一言難盡,5kb/s的速度我下載了一個星期,放到網盤自取吧,
https://pan.baidu.com/s/1-307NLJENO8MHgkcGRzm3Q 提取碼: c1gv
https://pan.baidu.com/s/1FF4asm_pbw4jK8JOYksbxQ 提取碼: cjx8
官網地址:https://www.shapenet.org/
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/257460.html
標籤:python
下一篇:日期與時間處理詳解
