build details

# TensorFlow Template

Modified 2021-11-03 by tanij

This section describes the basic procedure for making a submission with a model trained in using TensorFlow. It can be used as a starting point for any of the `LF`, `LFV`, and `LFI` challenges.

That you have setup your accounts.

That you meet the software requirement.

9 GB free space.

You make a submission to all of the `LF*` challenges and can view their status and output.

## Quickstart

Modified 2020-11-07 by Andrea Censi

Clone the template repo:

``````$git clone git@github.com:duckietown/challenge-aido_LF-template-tensorflow.git `````` Change into the directory: ``````$ cd challenge-aido_LF-template-tensorflow
``````

Either make a submission with:

``````$dts challenges submit --challenge CHALLENGE_NAME `````` where you can find a list of the open challenges here. Or, run local evaluation with: ``````$ dts challenges evaluate --challenge CHALLENGE_NAME
``````

Modified 2019-04-15 by Liam Paull

This will make a number of submissions (as described below). You can track the status of these submissions in the command line with:

``````\$ dts challenges follow --submission SUBMISSION_NUMBER
``````

or through your browser by navigating the webpage: `https://challenges.duckietown.org/v4/humans/submissions/SUBMISSION_NUMBER`

where `SUBMISSION_NUMBER` should be replaced with the number of the submission which is reported in the terminal output.

## Anatomy of the submission

Modified 2020-11-06 by Liam Paull

The submission consists of all of the basic files that required for a basic submission. Below we will highlight the specifics with respect to this template.

### `solution.py`

Modified 2020-11-07 by Liam Paull

The only difference in `solution.py` is that we are initializing our model:

``````from model import TfInference
# define observation and output shapes
self.model = TfInference(observation_shape=(1,) + expect_shape,
# this is the shape of the image we get.
action_shape=(1, 2),  # we need to output v, omega.
graph_location='tf_models/')  # this is the folder where our models are stored.
self.current_image = np.zeros(expect_shape)
``````

and then we call our model to compute an action with the following code:

``````def compute_action(self, observation):
action = self.model.predict(observation)
return action.astype(float)
``````

Note that we also can require the presence of a GPU with the environment variable `AIDO_REQUIRE_GPU` and then the solution will fail if a GPU is not found.

### Model files

Modified 2020-11-06 by Liam Paull

The other additional files are the following:

``````tf_models/
model.py
``````

The directory `tf_models/` contains the Tensorflow learned models (the ones that you have trained).

The `model.py` code is the code that runs the Tensorflow model.