-
Notifications
You must be signed in to change notification settings - Fork 7
Add background remove, resizing, and additional pipelines (#277, #271, #267) #278
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
Conversation
e3167f7 to
18d8636
Compare
This commit also changes the signature of run_reconstruction to:
run_reconstruction(images: list[Path],
pipeline_name: str = "default_pipeline"
)-> Tuple[Photoscan, Path]
Here, pipeline_name is now a string representing the name of a .mg
pipeline in the meshroom_pipelines folder.
These warnings break the CI on windows11 python3.12, because we configure our pytest to treat all warnings as errors. There is a chance that the ONNX runtime support limitation warnings are not actually harmful to the user and just indicate a lack of official testing and support from Microsoft: microsoft/onnxruntime#20001 (comment)
ad0cb71 to
2ee2676
Compare
2ee2676 to
09b88a4
Compare
ebrahimebrahim
left a comment
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.
Amazing work! Things ran very smoothly. The code is clean. Several changes requested, including two sections for which I think unit testing will pay off.
Note that I force-pushed to rebase to main, and I also pushed a couple of minor things, so please reset your local version of this branch to here before you continue working. I won't mess with the branch again without prior warning 😄
| """Get the MODNet checkpoint path. Download it if not present. | ||
| """ | ||
| package = "openlifu.trk.modnet_checkpoints" | ||
| filename = "modnet_photographic_portrait_matting.onnx" |
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.
let's add src/openlifu/trk/modnet_checkpoints/modnet_photographic_portrait_matting.onnx to the .gitignore at the top level of this repo
or maybe more generally just *.onnx?
cf1718e to
9e8786b
Compare
ebrahimebrahim
left a comment
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.
everything works seamlessly, and many thanks for the unit tests!
| # Test inverse is consistent | ||
| for orientation in range(9): | ||
| img_tform = apply_exif_orientation_numpy(img, orientation) | ||
| img_recon = apply_exif_orientation_numpy(img_tform, orientation, inverse=True) | ||
| np.testing.assert_array_equal(img, img_recon) |
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.
(excellent!)
This pull request adds several new capabilities to the
run_reconstructionfunction:(Issue Downsample/Normalize resolution of photoscan reconstruction inputs #277) Adds a new argument
new_widththat resizes the images to the specified width while maintaining the aspect ratio.(Issue Photoscan background removal #267) Adds an argument
use_mask. When set toTrue, this runs MODNet on each image to obtain a background mask. The mask is then used to filter the depth maps during reconstruction with Meshroom.To use this feature:
MODNET_PATHto the path of the downloaded checkpoint, e.g.:(Issue Meshroom pipeline optimization #271) Adds a new argument
pipeline_namethat specifies one of the custom pipelines located in themeshroom_pipelinesfolder.