tf-tutorial | From basic linear regression , to CNN , to RNN , to seq2seq | Machine Learning library
kandi X-RAY | tf-tutorial Summary
kandi X-RAY | tf-tutorial Summary
本项目是一套面向初学者的 TF 教程。 其中介绍了 TF 的基本用法、一点点 CNN,着重强调了 seq2seq 模型。 seq2seq 的 API 在 TF 中文档支持并不好,这也是本项目诞生的原因。 本项目展示了如何使用 seq2seq 中的 API 以及 AttentionWrapper,并从源码的角度来澄清一些重要概念。. This project is a TensorFlow Tutorial for beginners. It introduces basic usage in TF, very little CNN, and emphasizes seq2seq models. The seq2seq APIs in TF are not well documented, and this is why I made this project. It shows how to use seq2seq APIs and AttentionWrapper, and dive into the source code to make key concepts clear.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Train the network
- Draw random samples
- Generate random data
- Plots the attention matrix
- Try to download a file
- Convolution layer
- Return the next batch
- Return the ID of a character
- Returns the next batch
- Convert a character to integer
- A layer of fc layer
- Convert batches to string
- Convert dict id to character
- Return a list of characters from probabilities
- Convert dict ID to character
- Read data from a zip file
- Sample from prediction
- Sample a distribution from a distribution
- Get the input and output from the given IDs
- Random distribution
- Compute the log probability of predictions
tf-tutorial Key Features
tf-tutorial Examples and Code Snippets
Community Discussions
Trending Discussions on tf-tutorial
QUESTION
I read the Skins section in glTF's github tutorial, but failed to understand how jointMatrix
works.
In the tutorial, it's defined as
...ANSWER
Answered 2021-Mar-17 at 17:55One thing to keep in mind is that the vertex shader is executing within the context of the skinned mesh node, not the skeleton root or joints. This means that the model view matrix is potentially in a "meaningless" place: This skinned node may have been given a transformation, but it won't be affected by that as all of its vertices are controlled by joints instead. The glTF Validator will even warn if a skinned node is NOT a root node, for this reason, as transforms applied to the skin itself are no-ops.
So the steps needed for any particular vertex in the skin then are:
- Undo the skin's world-to-node transformations, if any.
- Apply the joint's world-to-joint transformations.
- Undo the "rest" position of the joint.
These three steps correspond to the three you listed from the tutorial.
Let's talk about the third one. Each joint has a "rest" position. For example an arm bone might be at rest in the left arm of the skin's original shape (bind pose), and a leg bone might be in the right leg for example. These bones don't sit at the origin, they are sprinkled all around the model. But we don't want them pulling vertices around when they are in the rest position, for example the arm bone might be above and to the left of the origin but shouldn't pull any vertices up and to the left when it's at rest.
So each joint has an "inverse bind matrix" that undoes the effects that the joint would naturally have in its own rest position. When the joint moves, it moves relative to its own rest position, and that delta (the difference between steps 2 and 3) is what gets applied to the target vertex.
If the skin itself tries to move, nothing happens. Such a transform is applied to u_modelViewMatrix
at the end of the tutorial's shader, and the inverse of that transform is applied in step 1, so they cancel out. If you wanted to move the entire skinned mesh, of course the correct way to do that is by repositioning the whole skeleton, not the skinned node. Moving the root joint would apply new transformations in step 2 for all vertices in the mesh.
QUESTION
I have a simple blender model which consists of three meshes with three bones controlling one mesh each. The animation is just the bones rotating the cubes a bit around the y-axis and back. The center bone is the parent of the two outer bones.
I then export this scene with the GLTF2.0 (text version) export plugin and am now trying to import this into my newly made opengl engine (c# xamarin android).
Since I want to understand the GLTF2.0 format and skeletal animation in OpenGL completely, I am trying to implement the GLTF2.0 reading myself.
I read:
- https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_020_Skins.md
- https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/README.md
- https://kcoley.github.io/glTF/specification/2.0/figures/gltfOverview-2.0.0a.png
Displaying the meshes was easy, but now I am stuck making the animations work. In my gltf file I see three skins:
...ANSWER
Answered 2019-May-07 at 20:17I'm trying to address your questions one by one
- Why are there three skins? Why is the inverseBindMatrices bound to a skin and not to a joint?
As you already found out, there is one skin per mesh. THe fact that in your specific case, you could merge all three meshes into one, doesn't really restrict this general principle. However
I think there needs to be an inverse bind matrix for each mesh in order to be able to transform the mesh to bone space (and - if need be - back).
There is an inverse bind matrix for each joint of each mesh. The name of the property is inverseBindMatrices
in plural for a reason, and it references a bufferview
which in turn references some data in a buffer
.
Changing the order of your question here, because this way it will make more sense:
Every bone node in the file has its own rotation, translation, scale values but no matrix. Why is that? Isn't there something missing?
What else do you need? Every affine transformation can be decomposed into translation, rotation and scale, so the data is complete. glTF spec defines that the resulting matrix should be calculated in the order T*R*S
.
- When I have the right rotation, scaling, translation from a key frame (per bone), how do I calculate the matrices for each bone that I need to pass to my vertex shader?
For each bone node i
, you can calculate a local transformation as M_local(i) = T(i)*R(i)*S(i)
. You will get the joint matrices by applying the complete hierachy, so basically M_global(i) = M_global(parent(i)) * M_local(i)
and can then construct the join matrices as M_joint(i) = inverse(globalTransform) * M_global(i) * inverseBindMatrix(i)
.
- The gltf file referse to a bone (joint) as a node id, but the weights/jointId-Arrays that get passed as attributes to the shader do not match these bone ids: jointIds-Array contains i.e. 0,1,2 for the bone ids, but the bones are in nodes 4,5,6 - how do I find the right bone for each jointId passed to the shader?
The jointIds
Array contains references to the joints, not the bones (hence the name). The skinning shader does not care about bones at all, all what the bones do is define the hierachy for the joints here, so they influence the actual values of the M_global
and hence also the M_joint
matrices. The i
-th entry just references the i
-th joint in the joints
array of the respective skin, hence it needs M_joint(i)
.
- Since every Skin has a list of three (or max. 4) Joints, these are the Joints of which the final transformations need to be passed to the vertex shader.
Why would a skin
be limited to 4 joints. A skin can have as many joints a one likes.
If you have 8 Joints but the current to-be-drawn Mesh only gets affected by 4 of them, why should you pass all 8 matrices instead of only the 4 you need.
Why would you define a skin of 8 bones for a mesh which only needs four? The glTF data format does not prevent you from storing irrelevant information, or store information in an inefficient way.
The point to note here is that the hierachy between the joints is still defined by the bone node hierachy of the skeleton
. So you can leave out arbitrary joints in a single skin
, but these bone nodes (and a potential animation for them) can still affect the final joint matrices - for any joint defined by a bone which is below the "left out" bones in the skeleton bone hierachy.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tf-tutorial
You can use tf-tutorial like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page