Introduction
from PIL import Image
from matplotlib import pyplot as plt
from utils import working_directory, interactive_plot, get_errors_index
with working_directory('..'):
from polar import load_sample_data, POLAR
kaleido
is only required to save Plotly figures as jpeg image, so that they can be displayed in the web documentation.
It is not required when running this notebook.
%pip install -U kaleido
views, degradations, R_abs_gt = load_sample_data('outliers')
model = POLAR(**degradations)
model.fit(views.cuda())
get_errors_index(model.get_matrix(rotation_only=True), R_abs_gt)
loss = model.get_mean_losses(multistart=True)
plt.plot(loss); plt.show()
This is just to display the Plotly figure as an image in the web documentation.
If you are running this notebook, just call interactive_plot(model.template.detach())
fig = interactive_plot(model.template.detach(), return_fig=True)
fig.show()
fig.write_image("template.jpeg")
Image.open('./template.jpeg')