|
|
|
@ -424,6 +424,7 @@ def show_full_render(
|
|
|
|
|
target_silhouette,
|
|
|
|
|
loss_history_color,
|
|
|
|
|
loss_history_sil,
|
|
|
|
|
iteration
|
|
|
|
|
):
|
|
|
|
|
"""
|
|
|
|
|
This is a helper function for visualizing the intermediate results of the
|
|
|
|
@ -481,10 +482,11 @@ def show_full_render(
|
|
|
|
|
ax_.axis("off")
|
|
|
|
|
ax_.set_title(title_)
|
|
|
|
|
fig.canvas.draw()
|
|
|
|
|
fig.show()
|
|
|
|
|
display.clear_output(wait=True)
|
|
|
|
|
display.display(fig)
|
|
|
|
|
return fig
|
|
|
|
|
fig.savefig(f"results/fullrender_{iteration:05d}.png")
|
|
|
|
|
#fig.show()
|
|
|
|
|
#display.clear_output(wait=True)
|
|
|
|
|
#display.display(fig)
|
|
|
|
|
#return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
@ -521,11 +523,11 @@ n_iter = 3000
|
|
|
|
|
loss_history_color, loss_history_sil = [], []
|
|
|
|
|
|
|
|
|
|
# The main optimization loop.
|
|
|
|
|
for iteration in range(n_iter):
|
|
|
|
|
for iteration in tqdm(range(n_iter)):
|
|
|
|
|
# In case we reached the last 75% of iterations,
|
|
|
|
|
# decrease the learning rate of the optimizer 10-fold.
|
|
|
|
|
if iteration == round(n_iter * 0.75):
|
|
|
|
|
print("Decreasing LR 10-fold ...")
|
|
|
|
|
tqdm.write("Decreasing LR 10-fold ...")
|
|
|
|
|
optimizer = torch.optim.Adam(
|
|
|
|
|
neural_radiance_field.parameters(), lr=lr * 0.1
|
|
|
|
|
)
|
|
|
|
@ -595,7 +597,7 @@ for iteration in range(n_iter):
|
|
|
|
|
|
|
|
|
|
# Every 10 iterations, print the current values of the losses.
|
|
|
|
|
if iteration % 10 == 0:
|
|
|
|
|
print(
|
|
|
|
|
tqdm.write(
|
|
|
|
|
f"Iteration {iteration:05d}:"
|
|
|
|
|
+ f" loss color = {float(color_err):1.2e}"
|
|
|
|
|
+ f" loss silhouette = {float(sil_err):1.2e}"
|
|
|
|
@ -623,6 +625,7 @@ for iteration in range(n_iter):
|
|
|
|
|
target_silhouettes[show_idx][0],
|
|
|
|
|
loss_history_color,
|
|
|
|
|
loss_history_sil,
|
|
|
|
|
iteration,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|