Import Actor and Critic for Image Observation Application

For example, assume that you have an environment with a 50-by-50 grayscale image
observation signal and a continuous action space. To train a policy gradient agent you
require the following function approximators, both of which must have a single 50-by-50
image input observation layer and a single scalar output value.

Actor — Selects an action value based on the
current observation

Critic — Estimates the expected long-term reward
based on the current observation

Also, assume that you have the following network architectures to import:

A deep neural network architecture for the actor with a 50-by-50 image input layer
and a scalar output layer, which is saved in the ONNX format
(criticNetwork.onnx).

A deep neural network architecture for the critic with a 50-by-50 image input layer
and a scalar output layer, which is saved in the ONNX format
(actorNetwork.onnx).

To import the critic and actor networks, use the importONNXLayers
function without specifying an output layer.

These commands generate a warning, which states that the network will not be trainable
until an output layer is added. When you use an imported network to create an actor or
critic representation, the Reinforcement Learning Toolbox™ software automatically adds an output layer for you.

After importing the networks, create the actor and critic function approximator
representations using the rlRepresentation function. To do so, first
obtain the observation and action specifications from the environment.

obsInfo = getObservationInfo(env);
actInfo = getActionInfo(env);

Create the critic representation, specifying the name of the input layer of the critic
network as the observation name.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.