DLR-RM / AugmentedAutoencoder

Official Code: Implicit 3D Orientation Learning for 6D Object Detection from RGB Images
MIT License
336 stars 97 forks source link

Run ae on Windows 10 using python 3.9 & tensorflow 2.6 #98

Closed princetn closed 2 years ago

princetn commented 2 years ago

I have tried to run the augmented autoencoder after following the instructions. Got it to the point of installing and creating the config files. When I tried to run this: ae_train exp_group/my_autoencoder -d I ran into a lot of trouble to get it to work. It started with issues of compatibility of tf1 so I had to manually fix one error at a time by manually migrating the installed code to tf2. Until I hit a dead end with:

train_op = tensorflow.contrib.training.create_train_op(ae.loss, optim, global_step=ae.global_step) Line 89 in ae_factory.py

I tried to replace it with this: train_op = tf_agents.utils.eager_utils.create_train_op(ae.loss, optim, global_step=ae.global_step) which results an another issue that I do not want to go into the rabbit hole of changing tensorflow libraries to get compatibility in how optimizer class is written to compute gradient.: in eager_utils.py (tf_agents package): grads = optimizer.compute_gradients( total_loss, variables_to_train, gate_gradients=gate_gradients, aggregation_method=aggregation_method) but optimizer doesn't have compute_gradients instead they use this: Compute the gradients for a list of variables. with tf.GradientTape() as tape: loss = vars = grads = tape.gradient(loss, vars) So at this point I kind of gave up. What versions of python & tensorflow was implemented for? is there an easy way to get compatibility with tensorflow 2? 2.6 or higher ? Thanks in advance.

MartinSmeyer commented 2 years ago

Hi @princetn

I have not tried it on Windows, but I just added support for Tensorflow 2.6. So please pull the updated repo.

I have also added a section with a conda environment that installs the AAE with python 3.7 and TF 2.6. It should also work with python 3.9.

See also here: https://github.com/DLR-RM/AugmentedAutoencoder#support-for-tensorflow-26--python-3