DLR-RM / AugmentedAutoencoder

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

Get 'utf8' decoding error when run in "cad" mode #88

Closed neixlo closed 3 years ago

neixlo commented 3 years ago

Hi @MartinSmeyer,

thanks for AugmentedAutoencoder and also for the new branch of multipath (I'll definitively look into that later).

I tried to fix the following issue on my own and with the known issues, sadly I couldn't make it. Do you have any idea whats going on here?

Thanks and best, Neixlo

Describe the bug When running with MODEL: reconst everything works and I get a propper rendered image when running ae_train exp_group/my_autoencoder -d (even if the model has no vertex colors). When running the same with MODEL: cad I get a 'utf8' decoding error.

At first I tried with my own cad models but the run below ist with the cad model from the TLESS dataset (from the "CAD models"). Same result, exept of the "decode byte 0xb0 in position 0" is different with my own model.

$ ae_train exp_group/my_autoencoder -d
(128, 128, 3)
[[8, 8], [16, 16], [32, 32], [64, 64]]
(?, 128, 128, 3)
(?, 128, 128, 3)
using egl   0% |                                     | 0 / 20000 ETA:  --:--:-- 
Traceback (most recent call last):                                             |
  File "/home/nixi/.local/bin/ae_train", line 8, in <module>
    sys.exit(main())
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/ae/ae_train.py", line 87, in main
    dataset.get_training_images(dataset_path, args)
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/ae/dataset.py", line 92, in get_training_images
    self.render_training_images()
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/ae/dataset.py", line 244, in render_training_images
    bgr_x, depth_x = self.renderer.render(
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/ae/utils.py", line 15, in decorator
    setattr(self, attribute, function(self))
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/ae/dataset.py", line 68, in renderer
    float(self._kw['vertex_scale'])
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/meshrenderer/meshrenderer.py", line 37, in __init__
    vert_norms = gu.geo.load_meshes(models_cad_files, vertex_tmp_store_folder, recalculate_normals=True)
  File "/home/nixi/.local/lib/python2.7/site-packages/auto_pose/meshrenderer/gl_utils/geometry.py", line 54, in load_meshes
    scene = pyassimp.load(model_path, pyassimp.postprocess.aiProcess_Triangulate)
  File "/home/nixi/.local/lib/python2.7/site-packages/pyassimp/core.py", line 315, in load
    scene = _init(model.contents)
  File "/home/nixi/.local/lib/python2.7/site-packages/pyassimp/core.py", line 211, in _init
    call_init(obj, target)
  File "/home/nixi/.local/lib/python2.7/site-packages/pyassimp/core.py", line 76, in call_init
    _init(obj.contents, obj, caller)
  File "/home/nixi/.local/lib/python2.7/site-packages/pyassimp/core.py", line 122, in _init
    target.name = str(obj.data.decode("utf-8"))
  File "/home/nixi/anaconda3/envs/AA2/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 0: invalid start byte

System Info Describe the characteristic of your environment:

my_autoencoder.cfg

[Paths]
MODEL_PATH: /home/nixi/Projects/datasets/TLESS/cad/obj_01.ply
BACKGROUND_IMAGES_GLOB: /home/nixi/Projects/datasets/background_imgs/*.jpg

[Dataset]
MODEL: cad
H: 128
W: 128
C: 3
RADIUS: 700
RENDER_DIMS: (720, 540)
K: [1075.65, 0, 720/2, 0, 1073.90, 540/2, 0, 0, 1]
# Scale vertices to mm
VERTEX_SCALE: 1
ANTIALIASING: 1
PAD_FACTOR: 1.2
CLIP_NEAR: 10
CLIP_FAR: 10000
NOOF_TRAINING_IMGS: 20000
NOOF_BG_IMGS: 15000

[Augmentation]
REALISTIC_OCCLUSION: False
SQUARE_OCCLUSION: False
MAX_REL_OFFSET: 0.20
CODE: Sequential([
    #Sometimes(0.5, PerspectiveTransform(0.05)),
    #Sometimes(0.5, CropAndPad(percent=(-0.05, 0.1))),
    Sometimes(0.5, Affine(scale=(1.0, 1.2))),
    Sometimes(0.5, CoarseDropout( p=0.2, size_percent=0.05) ),
    Sometimes(0.5, GaussianBlur(1.2*np.random.rand())),
    Sometimes(0.5, Add((-25, 25), per_channel=0.3)),
    Sometimes(0.3, Invert(0.2, per_channel=True)),
    Sometimes(0.5, Multiply((0.6, 1.4), per_channel=0.5)),
    Sometimes(0.5, Multiply((0.6, 1.4))),
    Sometimes(0.5, ContrastNormalization((0.5, 2.2), per_channel=0.3))
    ], random_order=False)

[Embedding]
EMBED_BB: True
MIN_N_VIEWS: 2562
NUM_CYCLO: 36

[Network]
BATCH_NORMALIZATION: False
AUXILIARY_MASK: False
VARIATIONAL: 0
LOSS: L2
BOOTSTRAP_RATIO: 4
NORM_REGULARIZE: 0
LATENT_SPACE_SIZE: 128
NUM_FILTER: [128, 256, 512, 512]
STRIDES: [2, 2, 2, 2]
KERNEL_SIZE_ENCODER: 5
KERNEL_SIZE_DECODER: 5

[Training]
OPTIMIZER: Adam
NUM_ITER: 30000
BATCH_SIZE: 64
LEARNING_RATE: 2e-4
SAVE_INTERVAL: 10000

[Queue]
# OPENGL_RENDER_QUEUE_SIZE: 500
NUM_THREADS: 10
QUEUE_SIZE: 50
MartinSmeyer commented 3 years ago

Hi @neixlo,

sorry for my late answer. I tested you config and it ran without problems for me with the T-LESS CAD models from the BOP challenge:

Screenshot from 2020-11-06 18-10-32

I have similar settings with pyassimp 3.3.1 and egl

MartinSmeyer commented 3 years ago

I suspect that you actually used an old version of the code. On June 23rd I did a bug fix on this part:

https://github.com/DLR-RM/AugmentedAutoencoder/commit/0c8100fda3a2c5bbd1af95f4aa6c4f2584d8c150#diff-8af60fcd7598e76a0eb925688f235b21920f72e0a2609631e622332422b053db

Maybe make sure that you have the newest code version here. Also remove all files in your $AE_WORKSPACE/tmp_datasets folder.

If you are still interested, I am pushing some more inference code for the multipath repo today as well.