-
Notifications
You must be signed in to change notification settings - Fork 488
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
Make ImplicitVolume updateable #228
Open
claforte
wants to merge
1
commit into
main
Choose a base branch
from
claforte/anya_ph2_from_main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,14 @@ | |
contract_to_unisphere, | ||
) | ||
from threestudio.models.networks import get_encoding, get_mlp | ||
from threestudio.utils.base import Updateable | ||
from threestudio.utils.misc import C | ||
from threestudio.utils.ops import get_activation | ||
from threestudio.utils.typing import * | ||
|
||
|
||
@threestudio.register("implicit-volume") | ||
class ImplicitVolume(BaseImplicitGeometry): | ||
class ImplicitVolume(BaseImplicitGeometry, Updateable): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed as BaseImplicitGeometry (inherit from BaseModule) is already Updateable. |
||
@dataclass | ||
class Config(BaseImplicitGeometry.Config): | ||
n_input_dims: int = 3 | ||
|
@@ -74,22 +76,25 @@ def configure(self) -> None: | |
self.encoding.n_output_dims, 3, self.cfg.mlp_network_config | ||
) | ||
|
||
def update_step(self, epoch: int, global_step: int, on_load_weights: bool = False): | ||
self.density_blob_scale = C(self.cfg.density_blob_scale, epoch, global_step) | ||
|
||
def get_activated_density( | ||
self, points: Float[Tensor, "*N Di"], density: Float[Tensor, "*N 1"] | ||
) -> Tuple[Float[Tensor, "*N 1"], Float[Tensor, "*N 1"]]: | ||
density_bias: Union[float, Float[Tensor, "*N 1"]] | ||
if self.cfg.density_bias == "blob_dreamfusion": | ||
# pre-activation density bias | ||
density_bias = ( | ||
self.cfg.density_blob_scale | ||
self.density_blob_scale | ||
* torch.exp( | ||
-0.5 * (points**2).sum(dim=-1) / self.cfg.density_blob_std**2 | ||
)[..., None] | ||
) | ||
elif self.cfg.density_bias == "blob_magic3d": | ||
# pre-activation density bias | ||
density_bias = ( | ||
self.cfg.density_blob_scale | ||
self.density_blob_scale | ||
* ( | ||
1 | ||
- torch.sqrt((points**2).sum(dim=-1)) / self.cfg.density_blob_std | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Do we want these changes to be permanent? Since it's 500 iters, it will be slower than the current config. Instead, maybe add another yaml file with these changes called
configs/experimental/zero123_updated.yaml
?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 believe the extra steps and the hyperparam changes are worth it in terms of higher quality... @voletiv do you mind testing it out with a few of your images?
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.
Actually... hold on, I want to run a few more tests