Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanna testing rendering #1044

Merged
merged 37 commits into from
Aug 18, 2022
Merged

Nanna testing rendering #1044

merged 37 commits into from
Aug 18, 2022

Conversation

AlvaroHG
Copy link
Collaborator

@AlvaroHG AlvaroHG commented Jul 23, 2022

Depends on #1040

  • Adds rendering unlit test in unity
  • Modifies Agent manager and Testing base to be able to get image payloads
  • Updates and fixes to Templates and TestTemplates
  • New python tests for RGB with light and depth.
    • Found differences between rgb between fifo and wsgi servers for further investigation
    • Two more rendering tests in the unity side for future work disabled due to inability to control resolution with UTF (unity test framework) or not trigger builds

@AlvaroHG AlvaroHG requested a review from Lucaweihs July 23, 2022 01:49
Copy link
Collaborator

@Lucaweihs Lucaweihs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! I only did a quick review, please let me know if there are any pieces you'd like me to take a closer look at. I've added a few comments, mostly related to removing some dead code.

@@ -129,8 +140,38 @@ def assert_near(point1, point2, error_message=""):
)


def assert_images_near(image1, image2, max_mean_pixel_diff=1):
return np.mean(np.abs(image1 - image2).flatten()) <= max_mean_pixel_diff
def assert_images_near(image1, image2, max_mean_pixel_diff=1, debug_save=False, filepath=""):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not actually asserting anything in this or the next function. Should we call them something like check_if_images_near or check_images_approx_equal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous names, now changed

Comment on lines 1166 to 1175
def depth_to_gray_rgb(data):
return (255.0 / data.max() * (data - data.min())).astype(np.uint8)

def save_image(name, image, flip_br=False):
import cv2
img = image
print("is none? {0} is none".format(img is None))
if flip_br:
img = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.imwrite("{}.png".format(name), img)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the same code as was added on line 84 above? Can we remove whichever is the duplicate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


}

# TODO rendering is different for fifo and wsgi server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof, I forgot about that... We should probably deprecate the wsgi server sometime.

Comment on lines 133 to 134
rgb_filename = "proc_rgb_lit.png"
ground_truth = cv2.imread(os.path.join(IMAGE_FOLDER_PATH, rgb_filename))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for now 👍 we should probably make it so that these test assets are downloaded from some S3 bucket in the future so that we don't grow the repository size in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is why I created the save function to place in a directory and then use the ci_poll task to copy test images to s3. Next PR :)

tasks.py Outdated
Comment on lines 3873 to 3885
import ai2thor.controller
import random
import json
import os
import cv2
import numpy as np
print(os.getcwd())
width = 300
height = 300
fov = 45
n = 20
import os
import json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally a fan of just having all imports at the top of the file, any desire not to do this? Same as the import of os on line 3821 above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree, for tasks which all vary widely in function this has been the standard each task imports it's things and runs in an independent context, removed duplicates though.

Comment on lines 34 to 42
// Creates problems with json serialization
// public Dictionary<string, WallRectangularHole> holes {
// get { return
// doors
// .Select(x => (x.Key, x.Value as WallRectangularHole))
// .Concat(windows.Select(x => (x.Key, x.Value as WallRectangularHole))
// ).ToDictionary(e => e.Key, e => e.Item2);
// }
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not synced with current nanna merge, already removed

Comment on lines 442 to 448
// if ( string.IsNullOrEmpty(obj.assetId) || !assetMap.ContainsKey(obj.assetId)) {
// return result;
// }

// var asset = assetMap.getAsset(obj.assetId);

// var holeOffset = getHoleAssetBoundingBox(obj.assetId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Copy link
Collaborator Author

@AlvaroHG AlvaroHG Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, removed

Comment on lines 645 to 649
// TODO: do global scaling on everything
// public static string scalePoints() {
// (Math.Round(pair.Item1.row * scale, precision), Math.Round(pair.Item1.col * scale, precision)),
// (Math.Round(pair.Item2.row * scale, precision), Math.Round(pair.Item2.col * scale, precision))
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Copy link
Collaborator Author

@AlvaroHG AlvaroHG Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 2680 to 2698
// public static ProceduralHouse houseFromRoom(

// def find_walls(floorplan: np.array):
// walls = defaultdict(list)
// for row in range(len(floorplan) - 1):
// for col in range(len(floorplan[0]) - 1):
// a = floorplan[row, col]
// b = floorplan[row, col + 1]
// if a != b:
// walls[(int(min(a, b)), int(max(a, b)))].append(
// ((row - 1, col), (row, col))
// )
// b = floorplan[row + 1, col]
// if a != b:
// walls[(int(min(a, b)), int(max(a, b)))].append(
// ((row, col - 1), (row, col))
// )
// return walls

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,2623 @@
using System.Collections.Generic;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this .orig file needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of a merge, now gone

@Lucaweihs
Copy link
Collaborator

Any idea why the build is failing?

@lgtm-com
Copy link

lgtm-com bot commented Jul 27, 2022

This pull request introduces 7 alerts when merging ecce546 into 243aa90 - view on LGTM.com

new alerts:

  • 3 for Module is imported more than once
  • 1 for Unused local variable
  • 1 for Container contents are never accessed
  • 1 for Useless assignment to local variable
  • 1 for Dereferenced variable may be null

@lgtm-com
Copy link

lgtm-com bot commented Aug 18, 2022

This pull request introduces 9 alerts when merging d63f276 into 7f79e43 - view on LGTM.com

new alerts:

  • 4 for Module is imported more than once
  • 2 for Useless assignment to local variable
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Container contents are never accessed
  • 1 for Dereferenced variable may be null

@AlvaroHG AlvaroHG merged commit 9075a0f into nanna Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants