Tensorflow DqnAgent policy vs collect_policy - tensorflow

Since there is no explanation in the TF API doc on what collect_policy really is, I looked into the source code: https://github.com/tensorflow/agents/blob/master/tf_agents/agents/dqn/dqn_agent.py
Can you describe policy and collect policy as exploitation phase policy and exploration phase policy (in terms of classic reinforcement learning without NNs)?
I just need to pin on it something what I know

Related

Federated Learning in Tensorflow Federated, is there any way to apply Early stopping on the client side?

I am using Tensorflow Federated to train a text classification model with the federated learning approach.
Is there any way to apply Early Stopping on the client-side? Is there an option for cross-validation in the API?
The only thing I was able to find is the evaluation:
evaluation = tff.learning.build_federated_evaluation(model_fn)
Which is applied to the model by the end of a federated training round.
Am I missing something?
One straightforward way to control the number of steps a client takes when using tff.learning.build_federated_averaging_process is by setting up each clients tf.data.Dataset with different parameters. For example limiting the number of steps with tf.data.Dataset.take. The guide tf.data: Build TensorFlow input pipelines has many more details.
Alternatively stopping based on a measurement of learning progress would require modifying some internals of the algorithm currently. Rather than using the APIs in tff.learning, it maybe simpler to poke around federated/tensorflow_federated/python/examples/simple_fedavg/ particularly the client training loop is here and could be modified to stop based on some criteria other than "end of dataset" (as currently used).

TensorFlow 2 documentation for graph-mode

When I check the TensorFlow documentation (Python API docs or guides), it all seems exclusively for eager-mode. Almost all the examples don't even mention this.
For some specific operation/function like tf.nn.relu, this does not really make any difference.
However, for more complex things like tf.data (Dataset API, guide), it likely makes a difference. Esp all the examples would be different for graph mode.
Where can I find recent documentation (API references, guides, tutorials, examples) for graph mode?
(My current fallback is to check latest TF 1 documentation. But at some point, this will become more and more outdated.)
Or is graph mode deprecated so far that documentation for it seems not necessary anymore?
Graph mode in TensorFlow 2 is different from graph mode in TensorFlow 1. Instead of using sessions and placeholders, TensorFlow 2 uses functions annotated with tf.function. The eager mode examples you see can be executed in graph mode by wrapping them within a tf.function.
If you prefer to use the TensorFlow 1 style of graph mode with sessions and placeholders, you can still do so in TensorFlow 2 by using the tf.compat.v1 module. The API docs in that module describe the TensorFlow 1 style of graph mode. You can find archived guides about TensorFlow 1 graph mode at https://github.com/tensorflow/docs/tree/master/site/en/r1/guide

Has tf.Estimator become obsolete in Tensorflow 2.0?

Today I've set up a custom model using its tf.Estimator high-level API in Tensorflow 2.0.
It was a pain in the *** to get it running, and there are very few complete examples online that implement custom Estimators in Tensorflow 2, which made me questioning the reasons for using this API.
According to the docs, the main advantages of using the tf.Estimator API are:
You can run Estimator-based models on a local host or on a distributed multi-server environment without changing your model. Furthermore, you can run Estimator-based models on CPUs, GPUs, or TPUs without recoding your model.
You no longer have to worry about creating the computational graph or sessions since Estimators handle all the "plumbing" for you
Advantage 2. clearly doesn't apply to Tensorflow 2.0 anymore, as it runs in eager mode by default, so you don't have to worry about sessions anyways.
Advantage 1. also seems quite irrelevant in Tensorflow 2.0 - using tf.distribute.Strategy, you can now easily run even high level tf.Keras models in a distributed fashion and on CPUs/GPUs/TPUs.
tf.Keras models are so much easier and faster to set up, so why did they even bother to keep the tf.Estimator API in Tensorflow 2.0? Are there other advantages of using this API?

Is there a worked example for neural network pruning for the Faster-RCNN architecture from TensorFlow's object detection api?

I am trying to find a worked example of neural network pruning for the Faster-RCNN architecture.
My core stack is Tensorflow 1.12, its object_detection API (link) on Python3.5.2 in Ubuntu 16.04 LTS. I came across some Neural Network Pruning repos (e.g. link, implementing NVIDIA's pruning paper with Taylor expansion link - looking the most promising however (a) implemented in Pytorch and (b) on classification networks rather than detectors).
I am also aware of the existence of a pruning functionality within TensorFlow under this package (link), but could only run an example found in the comments of the following StackOverflow question (link) to train and prune (not thoroughly tested) a simple Neural Network for hand written digits classification using MNIST dataset.
I am looking for a worked example and not reporting any bugs or issues in code.
Can someone point to me a worked example of pruning Faster-RCNN -or other detectors- found on the TensorFlow's object detection API (link), preferably using TensorFlow's pruning package (link)?
Pruning is orthogonal to the meta-architecture used for object detection. When we talk about the TensorFlow Object Detection API, it heavily relies on builders that read the config and create corresponding nets, classes etc. I believe you want to prune the feature extractor as the most heavy part. If so, you need to first prune some feature extractor from slim (let's say, Inception-V2), give it a name, add its pruned version to models, adjust proto config and many more. Shortly speaking, you need to introduce a new type of feature extractor. But I am not aware of any existing examples on that.

Probability parameters in Tensorflow Object Detection API image preprocessesing

I am training a ssd_inception neural network using the Tensorflow Object Detection API. In the pipeline config file, there are preprocessor options to augment images during training. Is there any way to introduce probability of applying a given preprocessing? E.g 20% that the image will change contrast etc. If not, are there any plans to do so?
We don't have any current plan to do that. But feel free to send in a pull request. We are happy to review.
See https://github.com/tensorflow/models/blob/master/object_detection/builders/preprocessor_builder.py and https://github.com/tensorflow/models/blob/master/object_detection/core/preprocessor.py to get started.