Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixed the following two bugs:
tf2 version incomplatibility
First, the codes constructing saliency models were incompatible with the tensorflow version 2.
donkeycar/donkeycar/management/makemovie.py
Lines 186 to 196 in 20bf83c
We should use the
GradientTape()
of tensorflow to calculate the gradient.uint8 conversion bug
Second, the conversion of RGB values from float (0.0, 1.0) to int (0, 255) was wrong,
donkeycar/donkeycar/management/makemovie.py
Lines 239 to 240 in 20bf83c
which creates artifacts as the bottom left figure shown. The red/yellow/blue parts are artifacts with RGB values over 255. Since some float values of the
image
array can be great than 1.0. I usecv2.normalize
to properly convert the RGB values from float to uint. The correct saliency map is represented as the yello-purple clould as the right figure shown.(left): video with artifacts (right): video with correct saliency mask