Hololens 使用Unet共享详细教程(一)

Hello World!我是山谷大叔~接下来我将出一系列Hololens开发教程(Hololens API解析空间共享、第三视角Spatial ViewMR交互设计视音频通讯服务器开发多人游戏实战……),感兴趣的朋友可以关注我哦。下面开始放干货!

#1.环境搭建
##1.1软件环境
使用 Unity5.6.2f1VS2015Update3 (安装2017也可以)
不需要装模拟器了,现在可以在unity上模拟input(WSAD,QE按键移动,shift+鼠标左键-点击,shift+鼠标右键-方向),其他功能还是要在真机上调试。
##1.2最新SDK下载
Hololens-MixedRealityToolkit下载地址
##1.3创建工程
###1.3.1创建新工程
新建工程
###1.3.2导入开发包
(先导入HoloToolkit-Unity-v1.5.8.0)
导入开发包
###1.3.3 项目设置
项目设置
#2.官方demo解析
空间共享需要了解的几个知识点
##2.1Unet通信
##2.2Windows.Networking.Sockets
##2.3Anchor空间锚
#3.最终演示效果
启动应用程序,两台hololens(可以更多台,只要你有)看到同一个UI面板,点击"显示发动机"(哪一台都可点击),之后在空间中出现一台发动机,两个hololens看到是在同一位置,其中一人用手拖拽移动发动机,另一人的视野中发送机也相应移动,两人可以随便操控,神奇吧~

演示动图

演示图1

演示图2

接下来,我将分几个章节详细介绍这些知识点。
(后续视频教程 群211031265)
Hololens 使用Unet共享详细教程(二)

  • 9
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
抱歉,作为AI语言模型,我不能编写代码。但是,我可以为您提供一些关于使用残差网络编写Unet网络的信息。 Unet网络是一种用于图像分割的卷积神经网络,它通常包含一个编码器和一个解码器。编码器将原始图像通过卷积和池化操作降采样为一个较小的特征图,而解码器则通过上采样和卷积操作将特征图恢复为原始图像大小,并输出像素级别的分类结果。 使用残差网络可以提高Unet网络的性能。残差网络是一种深度神经网络结构,它通过跨层连接来解决梯度消失问题,并使得网络更加容易训练。在Unet网络中,可以使用残差块来代替常规的卷积层,以增加网络的深度和性能。 下面是一个示例代码,其中使用了残差块来编写Unet网络: ``` import tensorflow as tf def residual_block(x, filters): shortcut = x x = tf.keras.layers.Conv2D(filters, 3, padding='same', activation='relu')(x) x = tf.keras.layers.BatchNormalization()(x) x = tf.keras.layers.Conv2D(filters, 3, padding='same', activation='relu')(x) x = tf.keras.layers.BatchNormalization()(x) x = tf.keras.layers.Add()([x, shortcut]) x = tf.keras.layers.Activation('relu')(x) return x def encoder_block(x, filters): x = tf.keras.layers.Conv2D(filters, 3, padding='same', activation='relu')(x) x = tf.keras.layers.BatchNormalization()(x) x = residual_block(x, filters) pool = tf.keras.layers.MaxPooling2D()(x) return pool, x def decoder_block(x, skip, filters): x = tf.keras.layers.Conv2DTranspose(filters, 2, strides=2, padding='same')(x) x = tf.keras.layers.concatenate([skip, x]) x = tf.keras.layers.Conv2D(filters, 3, padding='same', activation='relu')(x) x = tf.keras.layers.BatchNormalization()(x) x = residual_block(x, filters) return x def build_unet(input_shape): inputs = tf.keras.layers.Input(shape=input_shape) # Encoder e1, skip1 = encoder_block(inputs, 64) e2, skip2 = encoder_block(e1, 128) e3, skip3 = encoder_block(e2, 256) e4, skip4 = encoder_block(e3, 512) # Bridge b1 = residual_block(e4, 1024) # Decoder d1 = decoder_block(b1, skip4, 512) d2 = decoder_block(d1, skip3, 256) d3 = decoder_block(d2, skip2, 128) d4 = decoder_block(d3, skip1, 64) outputs = tf.keras.layers.Conv2D(1, 1, activation='sigmoid')(d4) model = tf.keras.models.Model(inputs=inputs, outputs=outputs) return model ``` 在这个Unet网络中,残差块被用来代替常规的卷积层,以增加网络的深度。编码器和解码器都是由多个残差块组成。使用残差网络可以显著提高Unet网络的性能,特别是在处理大型图像时。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山谷大叔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值