我的体素数据大小为32x32x32。我想将数据上采样到64x64x64。
我正在使用以下代码来实现这一目标。
val touches = RxView.touches(previousButton)
touches
.filter({ event -> event.action == MotionEvent.ACTION_DOWN })
.flatMap({
Observable.interval(500, 50, TimeUnit.MILLISECONDS)
.takeUntil(touches.filter({event -> event.action == MotionEvent.ACTION_UP}))
}).subscribe({ println("down") })
这是我得到的跟踪堆栈。
import collections
import os
import scipy.io as io
import numpy as np
import scipy.ndimage as nd
def getVoxelFromMat(path, cube_len=64):
voxels = io.loadmat(path)
voxels = np.pad(voxels,(1,1),'constant',constant_values=(0,0))
if cube_len != 32 and cube_len == 64:
voxels = nd.zoom(voxels, (2,2,2), mode='constant', order=0)
return voxels
files = collections.defaultdict(list)
root = ('/home/vkv/Desktop/3dgan_pytorch/3DShapeNets/volumetric_data')
for split in ['train', 'test']:
#files_list = [f for f in os.listdir(root + '/' + 'car' + '/' + '30/' + split) if f.endswith('.mat')]
files_list = [f for f in os.listdir(root + '/' + 'car' + '/' + '30/' + split) if f.endswith('.mat')]
files[split] = files_list
split = 'train'
file_name = files[split][5]
file_path = root + '/' + 'car' + '/' + '30/' + 'train' + '/' + file_name
volume = np.asarray(getVoxelFromMat(file_path, 64),dtype=np.bool)
print(volume)
还有其他方法可以进行上采样,我在这里做错了什么?