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

save camera exposure as part of snapshot #448

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/testbed.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,12 @@ void Testbed::save_snapshot(const std::string& filepath_string, bool include_opt
m_network_config["snapshot"]["nerf"]["rgb"]["measured_batch_size"] = m_nerf.training.counters_rgb.measured_batch_size;
m_network_config["snapshot"]["nerf"]["rgb"]["measured_batch_size_before_compaction"] = m_nerf.training.counters_rgb.measured_batch_size_before_compaction;
m_network_config["snapshot"]["nerf"]["dataset"] = m_nerf.training.dataset;

nlohmann::json::binary_t cam_exposure_json;
size_t cam_exposure_bytes = m_nerf.training.cam_exposure.size() * sizeof(AdamOptimizer<Eigen::Array3f>);
cam_exposure_json.resize(cam_exposure_bytes);
memcpy(cam_exposure_json.data(), m_nerf.training.cam_exposure.data(), cam_exposure_bytes);
m_network_config["snapshot"]["nerf"]["cam_exposure"] = cam_exposure_json;
}

m_network_config_path = filepath;
Expand Down Expand Up @@ -2265,6 +2271,14 @@ void Testbed::load_snapshot(const std::string& filepath_string) {
m_loss_scalar = m_network_config["snapshot"]["loss"];

m_trainer->deserialize(m_network_config["snapshot"]);

if (m_testbed_mode == ETestbedMode::Nerf) {
nlohmann::json::binary_t cam_exposure_json;
size_t cam_exposure_bytes = m_nerf.training.cam_exposure.size() * sizeof(AdamOptimizer<Eigen::Array3f>);
cam_exposure_json.resize(cam_exposure_bytes);
memcpy(cam_exposure_json.data(), m_nerf.training.cam_exposure.data(), cam_exposure_bytes);
m_network_config["snapshot"]["nerf"]["cam_exposure"] = cam_exposure_json;
}
}

void Testbed::load_camera_path(const std::string& filepath_string) {
Expand Down