-
Notifications
You must be signed in to change notification settings - Fork 228
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
Nanna testing rendering #1044
Conversation
There was a problem hiding this 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.
ai2thor/tests/test_unity.py
Outdated
@@ -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=""): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous names, now changed
ai2thor/tests/test_unity.py
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
rgb_filename = "proc_rgb_lit.png" | ||
ground_truth = cv2.imread(os.path.join(IMAGE_FOLDER_PATH, rgb_filename)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
// 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); | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removable?
There was a problem hiding this comment.
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
// if ( string.IsNullOrEmpty(obj.assetId) || !assetMap.ContainsKey(obj.assetId)) { | ||
// return result; | ||
// } | ||
|
||
// var asset = assetMap.getAsset(obj.assetId); | ||
|
||
// var holeOffset = getHoleAssetBoundingBox(obj.assetId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, removed
// 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)) | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// 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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removable?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Any idea why the build is failing? |
This pull request introduces 7 alerts when merging ecce546 into 243aa90 - view on LGTM.com new alerts:
|
This pull request introduces 9 alerts when merging d63f276 into 7f79e43 - view on LGTM.com new alerts:
|
Depends on #1040