Categories
Misc

Shaping the Future of Graphics with NVIDIA Technologies in Unreal Engine 5

With the launch of Unreal Engine 5, NVIDIA announces support with key RTX technologies for developers to propel their games and experiences to the next level.

Unreal Engine is an open and advanced real-time 3D creation platform. Evolving from its state-of-the-art use in game engines into a multitude of industries, creators can deliver cutting-edge content, interactive experiences, and immersive virtual worlds. NVIDIA strives to simplify adoption of our technologies for developers to get hands on with leading-edge RTX technologies.

NVIDIA is supporting the launch of Unreal Engine 5 with key RTX technologies.Tens of thousands of developers leverage NVIDIA technologies and Unreal Engine to propel their games and experiences to the next level. You can get started building applications today.

We’ve created a series of introductory videos for NVIDIA technologies in UE5 including:

The video below provides an overview for implementing ray tracing in Unreal Engine 5.

Figure 1. Learn how to set up Hardware Ray Tracing in Unreal Engine 5.

Deep Learning Super Sampling 

NVIDIA Deep Learning Super Sampling (DLSS) is a plug-in that uses deep learning algorithms to upscale or “super sample” an image, and helps during GPU heavy workloads like ray tracing. NVIDIA DLSS takes a lower resolution image and increases its resolution. 

Core benefits include uncompromised quality with higher performance. DLSS uses advanced AI rendering to produce image quality comparable to native resolution, and in some cases even better quality, while only conventionally rendering a fraction of the pixels. A new temporal feedback technique gives incredibly sharp image details and improved stability from frame to frame.

With DLSS, developers can choose among several image quality modes from Quality to Ultra Performance. Balancing quality and performance is done by controlling the game’s internal rendering resolution.

Additional benefits include:

  •  NVIDIA Image Sharpening with a spatial upscaler and sharpening algorithm for non-RTX GPUs for cross-platform support.
  • Deep Learning Anti-Aliasing mode or DLAA. This AI based anti-aliasing mode is for users with spare GPU headroom and looking for higher levels of image quality.

Get started with DLSS

To get started head to the DLSS download page, scroll down to the “Download UE Plugin” section, accept the terms of agreement, and launch the UE5 download link. Then you’re all set!  

For a more visual walkthrough on how to install and implement DLSS view the video below.

Figure 2. Learn how to use DLSS, DLAA, and NVIDIA Image Scalar for Unreal Engine 5.

RTX Global Illumination

NVIDIA RTX Global Illumination (RTXGI) is a fast, high quality, and scalable real-time global illumination solution. It uses ray tracing to provide infinite bounce in indirect lighting, without the need to bake lighting or create multiple light setups for scenes. 

You can customize RTXGI to your needs on any DXR-enabled GPU, including the GeForce RTX 30 series, RTX 20 series, GTX 1660 series, and GTX 10 series. RTXGI’s scalable design gives you the control to decide when and where you want to crank up performance or max out image quality.

RTXGI is a plugin for UE5, however if you want more advanced features like indirect lighting in reflections and translucency support you can download the NVRTX branch.

Get started with RTXGI

To get started head to the download page and scroll down to the “Download UE Plugin” section, click the terms of agreement to start the UE5 download link, and you’re set.  

View how to install and implement RTXGI with the video below.

Figure 3. RTXGI for Unreal Engine 5 offers indirect lighting, infinite colored bounces, and soft shadows while being fast and scalable.

NVIDIA Reflex

The NVIDIA Reflex plug-in reduces system latency, which is key for any title where a responsive experience is required. With native support in Unreal Engine 5, simply navigate to the plug-ins folder in UE5, search for NVIDIA Reflex, and enable. 

Key features include:

  • Low Latency Mode for reducing latency.
  • Reflex Stats and Latency Markers. With Reflex Stats, gamers can get per-frame PC Latency without any special hardware. This metric is ideal for tweaking game, OS, and GPU settings. 
  • Automatic Configuration and Flash Indicator for automatic configuration of the Reflex Analyzer. The Reflex Latency Analyzer detects clicks coming from your mouse and measures the time it takes for the resulting pixels (such as a gun muzzle flash) to change on screen. The results are displayed through GeForce Experience. 

Review the video walkthrough below for information on installing and implementing NVIDIA Reflex.

Figure 4. Learn how to reduce system latency by optimizing the mouse to screen chain of events using the NVIDIA Reflex.

NVIDIA Omniverse Connector for Unreal Engine 5 preview

NVIDIA Omniverse is a 3D design collaboration and virtual world simulation platform for creators to connect and enhance 3D workflows. Developers can also easily build advanced 3D tools and expand their ecosystem reach.

At GTC 2022, NVIDIA introduced an updated Omniverse Connector for Unreal Engine including the ability to export the source geometry of Nanite meshes from Unreal Engine 5.

Review the Omniverse Connect documentation for information on installing and using Unreal Engine Omniverse Connector 104.1. For more information on Unreal Engine and NVIDIA technologies, visit our Unreal Engine developer page.

*Disclaimer:  All versions of these plug-ins have been tested on UE 5.0 Preview 2, and may not be compatible in the full release of Unreal Engine 5.0.

Categories
Misc

Meet the Omnivore: Videographer Makes Digital Walls, Virtual Homes Pop With NVIDIA Omniverse

Pekka Varis’s artistry has come a long way from his early days as a self-styled “punk activist” who spray painted during the “old school days of hip hop in Finland.”

The post Meet the Omnivore: Videographer Makes Digital Walls, Virtual Homes Pop With NVIDIA Omniverse appeared first on NVIDIA Blog.

Categories
Misc

options to incorporate implicit feedback in tf recommender (retrieval) system + how to apply k-means clustering to trained user embeddings

hey,

I have a large database of hundreds of thousands of users interacting with thousands of products for given amount of time, with more time indicating more interest. My company wants to understand if there are particular subgroups of similar consumers. In order to discover if that’s the case, I’ve built a 2-stage ML approach:

– using a tfrs model based on the basic retrieval tutorial (https://www.tensorflow.org/recommenders/examples/basic_retrieval), I’ve trained embeddings to represent my users and products.

– using k-means clustering on the user embeddings, I classify a particular user as a member of a particular cluster.

With this approach, I run into 2 challenges:

– the basic retrieval does not take into account the implicit feedback of the amount of time. This seems like a recurring theme in this space – to weigh the user-item interactions by some measure of implicit feedback. I can’t seem to find any TF implementations though – any tips?

– my trained user embedding layer does not seem suitable for k-means clustering in a sense, since its measure of inter vs intra cluster distance does not meaningfully reduce over training iterations, and (more importantly) decreases linearly(!) with a higher value for k, making it impossible to use the elbow method to determine an objectively good trade-off between k and explained variance.

what would you advice to tackle both of these issues? Thanks for thinking along!
I know some of these questions are more ‘applied machine learning’ than ‘tensorflow’ per se, but I didn’t know where else to take this question, so apologies if this in the wrong category.

submitted by /u/the_Wallie
[visit reddit] [comments]

Categories
Misc

Is this kind of transfer learning is possible in Tensorflow

Hello I’m doing a CNN project for classification of Corn disease images(4 classes) It uses VGG16 as its base model. I have created and saved the model. Now is it possible to use that model as a base for another transfer learning task to classify cotton leaf disease images( 4 classes) with retaining the knowledge gained from corn disease images along with cotton leaf disease images? If so how should I modify the corn disease model. Should I need to make the output layer neurons as 8( 4 for cotton, 4 for corn disease) ?

submitted by /u/kudoshinichi-8211
[visit reddit] [comments]

Categories
Misc

Please help…..ValueError: A target array with shape (1288, 1) was passed for an output of shape (None, 256, 1) while using as loss `binary_crossentropy`. This loss expects targets to have the same shape as the output.

Hi everyone,

I am pretty new to ML and tensorflow and am getting stuck. I am trying to do text classification.

My dataset is in the form where each row has 2 columns: text and polarity

text = string/tweet

polarity = can be 0 or 1

I am generating BERT embeddings following this code https://github.com/strongio/keras-bert/blob/master/keras-bert.ipynb

I want to add a Bi-LSTM between Bert Layer and the Dense layer. I have done it like this:

bert_output = BertLayer(n_fine_tune_layers=3, pooling="mean")(bert_inputs) bert_output = tf.keras.layers.Reshape((max_seq_length, embedding_size))(bert_output) bilstm = tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(128, dropout=0.2,recurrent_dropout=0.2,return_sequences=True))(bert_output) output = tf.keras.layers.Dense(1, activation="softmax")(bilstm) model = tf.keras.models.Model(inputs=bert_inputs, outputs=output) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) model.summary() 

It gives an error:

ValueError: A target array with shape (1288, 1) was passed for an output of shape (None, 256, 1) while using as loss `binary_crossentropy`. This loss expects targets to have the same shape as the output. 

This is the link of the notebook in colab:

https://colab.research.google.com/drive/13g1ccE_cbSwEyUlKBxFRnvxtJ4gt38-g?usp=sharing

What can I do to resolve this? Does it have something to do with what activation or loss is being used ? How can the shape be matched?

Any help will be appreciated.

submitted by /u/No-Life-8250
[visit reddit] [comments]

Categories
Misc

error while quantiaztion tensorflow2 keras model

File “/opt/vitis_ai/conda/envs/vitis-ai-tensorflow2/lib/python3.7/site-packages/keras/engine/functional.py”, line 1163, in _deserialize_keras_tensor

layer = layer_map[layer_name]

KeyError: ‘activation_4’

Does anyone know how to solve this problem and what it is about .
This model is working fine without quantization

submitted by /u/Beginner_Journey
[visit reddit] [comments]

Categories
Misc

Tflite model gives different results in android application

I’m having a trained model of image classification which works fine on python but when i convert it to tflite and deploy on Android it gives different results Can anyone help me here

submitted by /u/shubham1300
[visit reddit] [comments]

Categories
Misc

Is it possible to use transfer learning to create a CNN model to classify alzheimer’s MRI images(4 classes) by using a pre-trainned model used for pneumonia xray(2 classes).

Hello I have been trying to create two tensorflow models to experiment with transfer learning. I have a trainned a cnn model for lung xray images for pneumonia(2 classes) by using the kaggle chest x-ray dataset .

Here is my code

import tensorflow as tf

import numpy as np

from tensorflow import keras

import os

from tensorflow.keras.preprocessing.image import ImageDataGenerator

from tensorflow.keras.preprocessing import image

import matplotlib.pyplot as plt

gen = ImageDataGenerator(rescale=1./255)

train_data = gen.flow_from_directory(“/Users/saibalaji/Downloads/chest_xray/train”,target_size=(500,500),batch_size=32,class_mode=’binary’)

test_data = gen.flow_from_directory(“/Users/saibalaji/Downloads/chest_xray/test”,target_size=(500,500),batch_size=32,class_mode=’binary’)

model = keras.Sequential()

# Convolutional layer and maxpool layer 1

model.add(keras.layers.Conv2D(32,(3,3),activation=’relu’,input_shape=(500,500,3)))

model.add(keras.layers.MaxPool2D(2,2))

# Convolutional layer and maxpool layer 2

model.add(keras.layers.Conv2D(64,(3,3),activation=’relu’))

model.add(keras.layers.MaxPool2D(2,2))

# Convolutional layer and maxpool layer 3

model.add(keras.layers.Conv2D(128,(3,3),activation=’relu’))

model.add(keras.layers.MaxPool2D(2,2))

# Convolutional layer and maxpool layer 4

model.add(keras.layers.Conv2D(128,(3,3),activation=’relu’))

model.add(keras.layers.MaxPool2D(2,2))

# This layer flattens the resulting image array to 1D array

model.add(keras.layers.Flatten())

# Hidden layer with 512 neurons and Rectified Linear Unit activation function

model.add(keras.layers.Dense(512,activation=’relu’))

# Output layer with single neuron which gives 0 for Cat or 1 for Dog

#Here we use sigmoid activation function which makes our model output to lie between 0 and 1

model.add(keras.layers.Dense(1,activation=’sigmoid’))

hist = model.compile(optimizer=’adam’,loss=’binary_crossentropy’,metrics=[‘accuracy’])

model.fit_generator(train_data,

steps_per_epoch = 163,

epochs = 4,

validation_data = test_data

)

I have saved the model in .h5 format.

Then I created a new notebook loaded data from kaggle for alzheimer’s disease and loaded my saved pneumonia model. Copied its layer to a new model except last layer then Freezed all the layers in the new model as non trainable. Then added a output dense layer with 4 neurons for 4 classes. Then trainned only the last layer for 5 epochs. But the problem is val accuaracy remains at 35% constant. How can I improve it.

Here is my code for alzeihmers model

import tensorflow as tf

from tensorflow import keras

from tensorflow.keras.preprocessing.image import ImageDataGenerator

from tensorflow.keras.preprocessing import image

import matplotlib.pyplot as plt

import numpy as np

gen = ImageDataGenerator(rescale=1./255)

traindata = datagen.flow_from_directory(‘/Users/saibalaji/Documents/TensorFlowProjects/ad/train’,target_size=(500,500),batch_size=32)

testdata = datagen.flow_from_directory(‘/Users/saibalaji/Documents/TensorFlowProjects/ad/test’,target_size=(500,500),batch_size=32)

model = keras.models.load_model(‘pn.h5’)

nmodel = keras.models.Sequential()

#add all layers except last one

for layer in model.layers[0:-1]:

nmodel.add(layer)

for layer in nmodel.layers:

layer.trainable = False

nmodel.add(keras.layers.Dense(units=4,name=’dense_last’))

hist = nmodel.compile(optimizer = tf.keras.optimizers.Adam(learning_rate=0.002),loss = ‘categorical_crossentropy’, metrics = [‘accuracy’])

nmodel.fit(x=traindata,validation_data=testdata,epochs=5,steps_per_epoch=160)

submitted by /u/kudoshinichi-8211
[visit reddit] [comments]

Categories
Misc

Merge Sort Explained: A Data Scientist’s Algorithm Guide

The article includes a step by step explanation of the merge sort algorithm and code snippets illustrating the implementation of the algorithm itself.

Data Scientists deal with algorithms daily. However, the data science discipline as a whole has developed into a role that does not involve implementation of sophisticated algorithms. Nonetheless, practitioners can still benefit from building an understanding and repertoire of algorithms.

In this article, the sorting algorithm merge sort is introduced, explained, evaluated, and implemented. The aim of this post is to provide you with robust background information on the merge sort algorithm, which acts as foundational knowledge for more complicated algorithms.

Although merge sort is not considered to be complex, understanding this algorithm will help you recognize what factors to consider when choosing the most efficient algorithm to perform data-related tasks. Created in 1945, John Von Neumann developed the merge sort algorithm using the divide-and-conquer approach.

Divide and conquer

To understand the merge sort algorithm, you must be familiar with the divide and conquer paradigm, alongside the programming concept of recursion. Recursion within the computer science domain is when a method defined to solve a problem involves an invocation of itself within its implementation body.

In other words, the function calls itself repeatedly.

Visual illustration of recursion.
Figure 1. Visual illustration of recursion – Image by author.

Divide and conquer algorithms (which merge sort is a type of) employ recursion within its approach to solve specific problems. Divide and conquer algorithms decompose complex problems into smaller sub-parts, where a defined solution is applied recursively to each sub-part. Each sub-part is then solved separately, and the solutions are recombined to solve the original problem.

The divide-and-conquer approach to algorithm design combines three primary elements:

  • Decomposition of the larger problem into smaller subproblems. (Divide)
  • Recursive utilization of functions to solve each of the smaller subproblems. (Conquer)
  • The final solution is a composition of the solution to the smaller subproblems of the larger problem. (Combine)

Other algorithms use the divide-and-conquer paradigm, such as Quicksort, Binary Search, and Strassen’s algorithm.

Merge sort

In the context of sorting elements in a list and in ascending order, the merge sort method divides the list into halves, then iterates through the new halves, continually dividing them down further to their smaller parts.

Subsequently, a comparison of smaller halves is conducted, and the results are combined together to form the final sorted list.

Steps and implementation

Implementation of the merge sort algorithm is a three-step procedure. Divide, conquer, and combine.

The divide component of the divide-and-conquer approach is the first step. This initial step separates the overall list into two smaller halves. Then, the lists are broken down further until they can no longer be divided, leaving only one element item in each halved list.

The recursive loop in merge sort’s second phase is concerned with the list’s elements being sorted in a particular order. For this scenario, the initial array is sorted in ascending order.

In the following illustration, you can see the division, comparison, and combination steps involved in the merge sort algorithm.

Image showing the divide component of the merge sort algorithm.
Figure 2. Divide component illustration of the Merge sort algorithm—Image by Author.
Image showing the Conquer and combine component of the merge sort algorithm.
Figure 3. Conquer and combine components—Image by author.

To implement this yourself:

  • Create a function called merge_sort that accepts a list of integers as its argument. All following instructions presented are within this function.
  • Start by dividing the list into halves. Record the initial length of the list.
  • Check that the recorded length is equal to 1. If the condition evaluates to true, return the list as this means that there is just one element within the list. Therefore, there is no requirement to divide the list.
  • Obtain the midpoint for a list with a number of elements greater than 1. When using the Python language, the // performs division with no remainder. It rounds the division result to the nearest whole number. This is also known as floor division.
  • Using the midpoint as a reference point, split the list into two halves. This is the divide aspect of the divide-and-conquer algorithm paradigm.
  • Recursion is leveraged at this step to facilitate the division of lists into halved components. The variables ‘left_half’ and ‘right_half’ are assigned to the invocation of the ‘merge_sort’ function, accepting the two halves of the initial list as parameters.
  • The ‘merge_sort’ function returns the invocation of a function that merges two lists to return one combined, sorted list.
def merge_sort(list: [int]):
    list_length = len(list)
    
    if list_length == 1:
        return list
    
    mid_point = list_length // 2
    
    left_half = merge_sort(list[:mid_point])
    right_half = merge_sort(list[mid_point:])
    
    return merge(left_half, right_half)
  • Create a ‘merge’ function that accepts two lists of integers as its arguments. This function contains the conquer and combine aspects of the divide-and-conquer algorithm paradigm. All following steps are executed within the body of this function.
  • Assign an empty list to the variable ‘output’ that holds the sorted integers.
  • The pointers ‘i’ and ‘j’ are used to index the left and right lists, respectively.
  • Within the while loop, there is a comparison between the elements of both the left and right lists. After each comparison, the output list is populated within the two compared elements. The pointer of the list of the appended element is incremented.
  • The remaining elements to be added to the sorted list are elements obtained from the current pointer value to the end of the respective list.
def merge(left, right):
    output = []
    i = j = 0
    
    while (i 

Performance and complexity

Big O notation is a standard for defining and organizing the performance of algorithms in terms of their space requirement and execution time.

Merge sort algorithm time complexity is the same for its best, worst, and average scenarios. For a list of size n, the expected number of steps, minimum number of steps, and maximum number of steps for the merge sort algorithm to complete, are all the same.

As noted earlier in this article, the merge sort algorithm is a three-step process: divide, conquer, and combine. The ‘divide’ step involves the computation of the midpoint of the list, which, regardless of the list size, takes a single operational step. Therefore the notation for this operation is denoted as O(1).

The ‘conquer’ step involves dividing and recursively solving subarrays–the notation log n denotes this. The ‘combine’ step consists of combining the results into a final list; this operation execution time is dependent on the list size and denoted as O(n).

The merge sort notation for its average, best, and worst time complexity is log n * n * O(1). In Big O notation, low-order terms and constants are negligible, meaning the final notation for the merge sort algorithm is O(n log n). For a detailed analysis of the merge sort algorithm, refer to this article.

Evaluation

Merge sort performs well when sorting large lists, but its operation time is slower than other sorting solutions when used on smaller lists. Another disadvantage of merge sort is that it will execute the operational steps even if the initial list is already sorted. In the use case of sorting linked lists, merge sort is one of the fastest sorting algorithms to use. Merge sort can be used in file sorting within external storage systems, such as hard drives.

Key takeaways

This article describes the merge sort technique by breaking it down in terms of its constituent operations and step-by-step processes.

Merge sort algorithm is commonly used and the intuition and implementation behind the algorithm is rather straightforward in comparison to other sorting algorithms. This article includes the implementation step of the merge sort algorithm in Python.

You should also know that the time complexity of the merge sort method’s execution time in different situations, remains the same for best, worst, and average scenarios. It is recommended that merge sort algorithm is applied in the following scenarios:

  • When dealing with larger sets of data, use the merge sort algorithm. Merge sort performs poorly on small arrays when compared to other sorting algorithms.
  • Elements within a linked list have a reference to the next element within the list. This means that within the merge sort algorithm operation, the pointers are modifiable, making the comparison and insertion of elements have a constant time and space complexity.
  • Have some form of certainty that the array is unsorted. Merge sort will execute its operations even on sorted arrays, a waste of computing resources.
  • Use merge sort when there is a consideration for the stability of data. Stable sorting involves maintaining the order of identical values within an array. When compared with the unsorted data input, the order of identical values throughout an array in a stable sort is kept in the same position in the sorted output.
Categories
Misc

Inversion of a multivariable function

Hello everyone,

I’m pretty new to ML and tensorflow. What I’m trying to do now is practically to inverse a function using tensorflow.

So I have a function h=f(c1, c2,..cn, T). It is a smooth function of all the variables. I want to train a model which would give me T given known values of c1…cn and h.

For now I’m using a keras.Sequential model with 2 or 3 dense layers.

For loss I use ‘mean_absolute_error’, For optimizer – Adam().

To train the model I generate a dataset using my h(c1…cn, T) function by varying its arguments and using values of T as train_labels.

The accuracy of the resulting model is not very good to my mind – I’m getting errors of about 10%. To my mind this is not very good, given that the training dataset is ideally smooth.

My questions are:

  1. Am I doing something particularly wrong?

  2. How many units should I provide for each layer? I mean in tutorials they are using either Dense(64) or Dense(1). What difference does it make in my particular case? Should it be proportional to the number of parameters of the model?

  3. May be I should use some other types of layers/optimizers/losses?

Thank you in advance for your replies!

submitted by /u/_padla_
[visit reddit] [comments]