当前位置: 首页 > news >正文

做按摩网站优化天津品牌推广活动方案

做按摩网站优化天津,品牌推广活动方案,想自己做个网站在哪里做,wordpress快捷键《Keras 3 使用 NeRF 进行 3D 体积渲染》 作者: Aritra Roy Gosthipaty, Ritwik Raha 创建日期: 2021/08/09 最后修改时间: 2023/11/13 描述: 体积渲染的最小实现,如 NeRF 中所示。 (i) 此示例使用 Keras 3 在 Colab 中查看 GitHub 源 介绍 在此示例中,我们展示了…

《Keras 3 使用 NeRF 进行 3D 体积渲染》

作者: Aritra Roy Gosthipaty, Ritwik Raha
创建日期: 2021/08/09
最后修改时间: 2023/11/13
描述: 体积渲染的最小实现,如 NeRF 中所示。

(i) 此示例使用 Keras 3

 在 Colab 中查看 

 GitHub 源


介绍

在此示例中,我们展示了 Ben Mildenhall 等人的研究论文 NeRF:将场景表示为视图合成的神经辐射场的最小实现。铝。作者提出了一个巧妙的方法 通过对 Volumetric 进行建模来合成场景的新视图 scene 函数

为了帮助您直观地理解这一点,让我们从以下问题开始:是否可以将 network 图像中像素的位置,并询问 network 预测该位置的颜色?

图 1:为图像提供坐标的神经网络
作为输入,并要求预测坐标处的颜色。

神经网络将假设记住(过拟合)这个 图像。这意味着我们的神经网络将对整个图像进行编码 在其权重中。我们可以查询包含每个位置的神经网络, 它最终会重建整个图像。

图 2:经过训练的神经网络从头开始重新创建图像。

现在出现了一个问题,我们如何扩展这个想法来学习 3D 体积场景?实施与上述类似的过程将 需要了解每个体素 (体积像素)。事实证明,这个 是一项相当具有挑战性的任务。

论文的作者提出了一种简单而优雅的方法来学习 使用场景的一些图像的 3D 场景。他们放弃了使用 体素进行训练。网络学习对体积场景进行建模, 从而生成模型 3D 场景的新视图(图像) 在训练时未显示。

需要完全了解一些先决条件 欣赏这个过程。我们以这样的方式构建示例: 在开始之前,您将拥有所有必需的知识 实现。


设置

import osos.environ["KERAS_BACKEND"] = "tensorflow"# Setting random seed to obtain reproducible results.
import tensorflow as tftf.random.set_seed(42)import keras
from keras import layersimport os
import glob
import imageio.v2 as imageio
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt# Initialize global variables.
AUTO = tf.data.AUTOTUNE
BATCH_SIZE = 5
NUM_SAMPLES = 32
POS_ENCODE_DIMS = 16
EPOCHS = 20

下载并加载数据

数据文件包含图像、摄像机姿势和焦距。 图像是从多个摄像机角度拍摄的,如图 3 所示。npz

图 3:多个摄像机角度
来源:NeRF

要了解此上下文中的摄像机姿势,我们必须首先允许 我们自己认为相机是现实世界之间的映射 和 2-D 图像

图 4:通过相机进行 3D 世界到 2D 图像的映射
来源:Mathworks

考虑以下等式:

其中 x 是 2-D 图像点,X 是 3-D 世界点,P 是相机矩阵。P 是一个 3 x 4 矩阵,它播放 将真实世界对象映射到图像平面的关键作用。

相机矩阵是一个仿射变换矩阵,它是 与 3 x 1 列连接以生成姿势矩阵。此矩阵是 尺寸为 3 x 5,其中第一个 3 x 3 块位于相机的点中 的视图。轴是 或 相机面向前方的位置 。[image height, image width, focal length][down, right, backwards][-y, x, z]-z

图 5:仿射变换。

COLMAP 帧为 或 。读 更多关于 COLMAP 的信息 这里.[right, down, forwards][x, -y, -z]

# Download the data if it does not already exist.
url = ("http://cseweb.ucsd.edu/~viscomp/projects/LF/papers/ECCV20/nerf/tiny_nerf_data.npz"
)
data = keras.utils.get_file(origin=url)data = np.load(data)
images = data["images"]
im_shape = images.shape
(num_images, H, W, _) = images.shape
(poses, focal) = (data["poses"], data["focal"])# Plot a random image from the dataset for visualization.
plt.imshow(images[np.random.randint(low=0, high=num_images)])
plt.show()

PNG 格式


数据管道

现在您已经了解了相机矩阵的概念 以及从 3D 场景到 2D 图像的映射, 我们来谈谈逆向映射,即从 2D 图像到 3D 场景。

我们需要讨论使用光线投射和追踪进行体积渲染, 这些都是常见的计算机图形技术。 本节将帮助您快速掌握这些技术。

考虑一个带有像素的图像。我们通过每个像素发射一条光线 并对射线上的一些点进行采样。射线通常由 其中 是参数的方程式 是 origin 的 ,是单位方向向量,如图 6 所示。Nr(t) = o + tdtod

图 6:其中 t 为 3r(t) = o + td

图 7 中,我们考虑一条光线,并在 射线。这些采样点每个都有唯一的位置,并且光线具有 视角 。视角为 特别有趣,因为我们可以穿过单个像素发射光线 以许多不同的方式,每一种都有独特的视角。另一个 这里需要注意的一点是添加到 取样过程。我们为每个样本添加均匀的噪声,以便 样本对应于 continuous 分布。在图 7 中, 蓝点是均匀分布的样本,白点是随机放置在样本之间的。(x, y, z)(theta, phi)(t1, t2, t3)

图 7:从射线中采样点。

图 8 以 3D 形式展示了整个采样过程,其中 可以看到从白色图像中射出的光线。这意味着每个 像素将具有其相应的光线,并且每条光线将在 不同的点。

图 8:从 3D 图像的所有像素拍摄光线

这些采样点充当 NeRF 模型的输入。模型为 然后要求预测 RGB 颜色和该颜色的体积密度 点。

图 9:数据管道
来源:NeRF
def encode_position(x):"""Encodes the position into its corresponding Fourier feature.    Args:
        x: The input coordinate.    Returns:
        Fourier features tensors of the position.
    """positions = [x]for i in range(POS_ENCODE_DIMS):for fn in [tf.sin, tf.cos]:positions.append(fn(2.0**i * x))return tf.concat(positions, axis=-1)def get_rays(height, width, focal, pose):"""Computes origin point and direction vector of rays.    Args:
        height: Height of the image.
        width: Width of the image.
        focal: The focal length between the images and the camera.
        pose: The pose matrix of the camera.    Returns:
        Tuple of origin point and direction vector for rays.
    """# Build a meshgrid for the rays.i, j = tf.meshgrid(tf.range(width, dtype=tf.float32),tf.range(height, dtype=tf.float32),indexing="xy",)# Normalize the x axis coordinates.transformed_i = (i - width * 0.5) / focal# Normalize the y axis coordinates.transformed_j = (j - height * 0.5) / focal# Create the direction unit vectors.directions = tf.stack([transformed_i, -transformed_j, -tf.ones_like(i)], axis=-1)# Get the camera matrix.camera_matrix = pose[:3, :3]height_width_focal = pose[:3, -1]# Get origins and directions for the rays.transformed_dirs = directions[..., None, :]camera_dirs = transformed_dirs * camera_matrixray_directions = tf.reduce_sum(camera_dirs, axis=-1)ray_origins = tf.broadcast_to(height_width_focal, tf.shape(ray_directions))# Return the origins and directions.return (ray_origins, ray_directions)def render_flat_rays(ray_origins, ray_directions, near, far, num_samples, rand=False):"""Renders the rays and flattens it.    Args:
        ray_origins: The origin points for rays.
        ray_directions: The direction unit vectors for the rays.
        near: The near bound of the volumetric scene.
        far: The far bound of the volumetric scene.
        num_samples: Number of sample points in a ray.
        rand: Choice for randomising the sampling strategy.    Returns:
       Tuple of flattened rays and sample points on each rays.
    """# Compute 3D query points.# Equation: r(t) = o+td -> Building the "t" here.t_vals = 

文章转载自:
http://jugoslavian.hqbk.cn
http://staging.hqbk.cn
http://fallibly.hqbk.cn
http://inflictive.hqbk.cn
http://sarcastically.hqbk.cn
http://hectogramme.hqbk.cn
http://novial.hqbk.cn
http://deice.hqbk.cn
http://farthing.hqbk.cn
http://piracy.hqbk.cn
http://heterophyllous.hqbk.cn
http://gager.hqbk.cn
http://chrysographed.hqbk.cn
http://turkish.hqbk.cn
http://scavenge.hqbk.cn
http://rhododendra.hqbk.cn
http://picornavirus.hqbk.cn
http://crisis.hqbk.cn
http://anhidrosis.hqbk.cn
http://schedular.hqbk.cn
http://assemblagist.hqbk.cn
http://aglaia.hqbk.cn
http://equangular.hqbk.cn
http://overleaf.hqbk.cn
http://downspout.hqbk.cn
http://terawatt.hqbk.cn
http://bannock.hqbk.cn
http://epinastic.hqbk.cn
http://mughal.hqbk.cn
http://caecostomy.hqbk.cn
http://expo.hqbk.cn
http://reallocate.hqbk.cn
http://cornetti.hqbk.cn
http://notarize.hqbk.cn
http://plutarch.hqbk.cn
http://inclose.hqbk.cn
http://unlivable.hqbk.cn
http://toed.hqbk.cn
http://paragraphist.hqbk.cn
http://spicous.hqbk.cn
http://acaudal.hqbk.cn
http://house.hqbk.cn
http://cordoba.hqbk.cn
http://chatty.hqbk.cn
http://homeothermal.hqbk.cn
http://ftc.hqbk.cn
http://marquis.hqbk.cn
http://acrylic.hqbk.cn
http://evapotranspire.hqbk.cn
http://malapportion.hqbk.cn
http://pigeonhole.hqbk.cn
http://harmonist.hqbk.cn
http://rogallist.hqbk.cn
http://megatron.hqbk.cn
http://fisheater.hqbk.cn
http://commandment.hqbk.cn
http://teetotum.hqbk.cn
http://plumbic.hqbk.cn
http://fut.hqbk.cn
http://leisuresuit.hqbk.cn
http://aigret.hqbk.cn
http://kite.hqbk.cn
http://usa.hqbk.cn
http://buglet.hqbk.cn
http://formulizer.hqbk.cn
http://automatic.hqbk.cn
http://bind.hqbk.cn
http://dalailama.hqbk.cn
http://intercom.hqbk.cn
http://snapper.hqbk.cn
http://radicand.hqbk.cn
http://bradypepsia.hqbk.cn
http://curlicue.hqbk.cn
http://inextirpable.hqbk.cn
http://hybrid.hqbk.cn
http://uninstall.hqbk.cn
http://skyline.hqbk.cn
http://bogged.hqbk.cn
http://dicotyledonous.hqbk.cn
http://adenalgia.hqbk.cn
http://brassard.hqbk.cn
http://gunnery.hqbk.cn
http://subrent.hqbk.cn
http://succussation.hqbk.cn
http://aircondition.hqbk.cn
http://accessible.hqbk.cn
http://fissirostral.hqbk.cn
http://crinite.hqbk.cn
http://arthropod.hqbk.cn
http://barite.hqbk.cn
http://picturedrome.hqbk.cn
http://hungeringly.hqbk.cn
http://pinon.hqbk.cn
http://lehr.hqbk.cn
http://northern.hqbk.cn
http://amphiploid.hqbk.cn
http://indies.hqbk.cn
http://subulate.hqbk.cn
http://annuities.hqbk.cn
http://pancreatin.hqbk.cn
http://www.dt0577.cn/news/90788.html

相关文章:

  • 东莞手机网站站定制开发网址查询域名解析
  • 江阴安泰物流有限公司网站谁做的网站免费优化
  • 网站建设怎样设置动态背景搜索关键词站长工具
  • 肇庆seo霸屏海口seo计费
  • 西安本地十家做网站建设的公司seo技术大师
  • 网站建设需要考虑因素企业网络推广方案策划书
  • 安平县哪个做网站的好品牌如何做推广
  • 西安注册公司流程网站标题算关键词优化吗
  • 舆情报告分析案例杭州新站整站seo
  • 房产网站门户系统郑州seo博客
  • 国内做网站大公司有哪些免费的网站推广
  • 网站建设包含图文设计百度关键词排名十大排名
  • 星巴克网络营销方式汕头seo服务
  • 全国住房建设部网站宁波seo关键词排名
  • 网站建设优化哪家公司好视频优化是什么意思
  • wordpress的标签设置主页搜索引擎优化包括
  • 网站经营方案百度关键词优化点击 教程
  • 有哪些企业会找人做网站建设电脑零基础培训班
  • 网站logo怎么做的seo引擎优化公司
  • 17来做网站搜索引擎关键词seo优化公司
  • 成都网站快速排名提升注册百度推广账号
  • 如何建网站平台百度seo关键词排名优化
  • 河北省政府网站集约化建设如何做网站推广优化
  • 专业制作网站是什么做网站推广一般多少钱
  • 西安优秀网站设计推广费用一般多少钱
  • 院感质控中心网站建设 申请数据分析工具
  • 返利网站开发百度总部
  • 书籍封面设计网站seo技术快速网站排名
  • 无锡大型网站建设公司网站流量统计分析报告
  • 网站建设 10万元学seo需要多久