我需要调整一些3D数据的大小,例如tf.image.resize_images2d数据的方法。
我当时以为可以尝试tf.image.resize_images在循环和交换轴上运行它,但是我认为必须有一种更简单的方法。简单的最近邻居应该可以。
有任何想法吗?这不是理想的,但是我可以解决数据仅为0或1的情况,并使用类似以下内容:
tf.where(boolMap, tf.fill(data_im*2, 0), tf.fill(data_im*2), 1)
Run Code Online (Sandbox Code Playgroud)
但是我不知道如何得到boolMap。使用tf.while_loop来遍历所有值是否会大大降低性能?我觉得除非有某种自动循环并行化,否则它会在GPU上实现。
数据是大小的张量 [batch_size, width, height, depth, 1]
提前致谢。
注意输出尺寸应为:
[batch_size, width*scale, height*scale, depth*scale, 1]
我想出了这个:
def resize3D(self, input_layer, width_factor, height_factor, depth_factor):
shape = input_layer.shape
print(shape)
rsz1 = tf.image.resize_images(tf.reshape(input_layer, [shape[0], shape[1], shape[2], shape[3]*shape[4]]), [shape[1]*width_factor, shape[2]*height_factor])
rsz2 = tf.image.resize_images(tf.reshape(tf.transpose(tf.reshape(rsz1, [shape[0], shape[1]*width_factor, shape[2]*height_factor, shape[3], shape[4]]), [0, 3, 2, 1, 4]), [shape[0], shape[3], shape[2]*height_factor, shape[1]*width_factor*shape[4]]), [shape[3]*depth_factor, shape[2]*height_factor])
return tf.transpose(tf.reshape(rsz2, [shape[0], shape[3]*depth_factor, shape[2]*height_factor, shape[1]*width_factor, shape[4]]), [0, 3, 2, 1, …Run Code Online (Sandbox Code Playgroud) 好的.如果你有两个viewControllers,你从第一个到第二个进行模态Segue,那么你用[self dismissModalViewControllerAnimated:YES]解雇它; 它似乎没有回忆起viewDidLoad.我有一个主页面(viewController),然后是各种选项页面,我希望在更改选项时更新主页面.当我刚刚做了两个模态分段(一个前进,一个后退)时,这很有用,但这似乎是非结构化的,并且可能导致大型项目中的代码混乱.
我听说过push segues.他们还好吗?
谢谢.我感谢任何帮助:).
好的.所以我正在创建这个应用程序,除了一件事我真的很开心.它使用了大量的互联网数据库检查等,并且每次执行此操作时都会挂起,直到它完成,破坏了界面的流动性.反正有没有避免这个?当您单击按钮或有时仅因NSTimer而导致下载内容.我希望用户能够流畅地通过界面和应用程序在它到达时更新信息.无论如何还有吗?
编辑 - 当前同步代码:这是下载CSV文件:
NSString *link=[[NSString alloc] initWithFormat:@"http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=%@&callback=YAHOO.Finance.SymbolSuggest.ssCallback",timer.userInfo];
NSURL *url=[[NSURL alloc] initWithString:link];
NSData *dl=[[NSData alloc] initWithContentsOfURL:url];
NSString *str = [[NSString alloc] initWithData:dl encoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud)
这是将png文件下载到webView中:
NSString *link=[[NSString alloc] initWithFormat:@"http://chart.finance.yahoo.com/z?s=%@&t=GOOG&q=m",self.Input.text];
url=[[NSURL alloc] initWithString:link];
[self.graph loadRequest:[NSURLRequest requestWithURL:url]];
Run Code Online (Sandbox Code Playgroud) objective-c ×2
xcode ×2
3d ×1
download ×1
gpu ×1
ios ×1
iphone ×1
resize ×1
scale ×1
segue ×1
tensorflow ×1
viewdidload ×1