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

high-resolution images & a 2d discrete variational factor #1068

Merged
merged 63 commits into from
Sep 3, 2024

Conversation

jeff-regier
Copy link
Contributor

@jeff-regier jeff-regier commented Sep 3, 2024

Assorted changes:

  • Allows the decoder to efficiently generate high-resolution images (by injecting small stamps into large images)
  • Generates data by launching 16 worker processes (from Python; no need to launch multiple processes using a shell script)
  • Improves the neural network architecture, in part by making it more shallow and adding a skip connection earlier. It also removes CatalogNet.
  • Adds a new variational factor for locations/position that is based on a discrete 2d grid; it works better than the TruncationBivariateGaussian in my experiments.

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 54.83871% with 112 lines in your changes missing coverage. Please review.

Project coverage is 76.40%. Comparing base (bd96328) to head (2656a3d).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
bliss/encoder/encoder.py 68.13% 29 Missing ⚠️
bliss/main.py 25.71% 26 Missing ⚠️
bliss/catalog.py 19.23% 21 Missing ⚠️
bliss/simulator/prior.py 0.00% 18 Missing ⚠️
bliss/encoder/variational_dist.py 34.61% 17 Missing ⚠️
bliss/simulator/decoder.py 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1068      +/-   ##
==========================================
- Coverage   81.25%   76.40%   -4.86%     
==========================================
  Files          23       22       -1     
  Lines        3051     3085      +34     
==========================================
- Hits         2479     2357     -122     
- Misses        572      728     +156     
Flag Coverage Δ
unittests 76.40% <54.83%> (-4.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeff-regier jeff-regier merged commit 84ca732 into master Sep 3, 2024
2 of 3 checks passed
@jeff-regier jeff-regier deleted the jr/discrete_locs branch September 3, 2024 18:31
"galaxy_params": galaxy_params,
"star_fluxes": star_fluxes,
}
catalog_params["shear"] = shear
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shreyasc30 @timwhite0 The function _sample_galaxy_prior() no longer returns fluxes. I updated this code to account for the change but couldn't test it, so there may be minor syntax errors here.

ConvBlock(nch_hidden, 64, kernel_size=5, padding=2),
nn.Sequential(*[ConvBlock(64, 64, kernel_size=5, padding=2) for _ in range(1)]),
ConvBlock(nch_hidden, 64, kernel_size=5),
nn.Sequential(*[ConvBlock(64, 64, kernel_size=5) for _ in range(1)]),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shreyasc30 @timwhite0 The appropriate padding gets determined automatically now by ConvBlock, so padding is no longer an available argument.

tile_slen=self.tile_slen,
downsample_at_front=self.downsample_at_front,
)
n_params_per_source = self.var_dist.n_params_per_source
self.catalog_net = CatalogNet(num_features, n_params_per_source)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kapnadak @gapatron CatalogNet is no longer around. To account for this, I adjusted your code by removing its references to CatalogNet and by making the output of your GalaxyClusterFeaturesNet have the right output dimension to be used directly to parameterize the variational distribution. I haven't tested these changes though: some additional modifications may be needed.



def generate_one_file(gen_cfg: DictConfig, file_idx: int):
prior = instantiate(gen_cfg.prior)
Copy link
Contributor Author

@jeff-regier jeff-regier Sep 4, 2024

Choose a reason for hiding this comment

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

@kapnadak @gapatron The BLISS decoder can efficiently generate high-resolution images now. If you want to plug in your galaxy cluster prior, it just requires adjusting the config files so that cfg.generate.prior points to your prior rather than the default one.

nn.Upsample(scale_factor=2, mode="nearest"), # 8
C3(512, 256, n=3, shortcut=False),
nn.Upsample(scale_factor=2, mode="nearest"), # 10
C3(384, num_features, n=3, shortcut=False),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YicunDuanUMich @georgeyfly This new network architecture works quite a bit better for me (on SDSS, I haven't tried in on DC2). Will you try it out too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's nice to hear. I am glad to have a try on DC2 to see if it works better.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! I'll try it.

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.

3 participants