module: intrinsic.models

class intrinsic.models.IntrinsicImagesAlgorithm(*args, **kwargs)

Bases: common.models.EmptyModelBase

An algorithm together with the parameters used

active = None

if True, this is part of the current set of comparisons

baseline = None

if True, this algorithm is a simple non-algorithm

citation

citation for this algorithm

iiw_best = None

is this the best parameter setting for this slug?

iiw_mean_error = None

mean error across all IIW (“Intrinsic Images in the Wild” paper) images

iiw_mean_error_pretty()
iiw_mean_runtime = None

mean runtime across all IIW (“Intrinsic Images in the Wild” paper) images

intrinsic_images_decompositions
parameters = None

json-encoded dictionary of the parameters used

parameters_pretty_html()

Render the parameters as HTML

save(*args, **kwargs)
slug = None

url-friendly name of the algorithm

task_version = None

counter to keep track of stale jobs; this is only used during scheduling of decompositions. Increment this number to invalidate current tasks.

class intrinsic.models.IntrinsicImagesDecomposition(*args, **kwargs)

Bases: common.models.EmptyModelBase

Result of running an intrinisc images algorithm

ERROR_ATTRS = ['mean_dense_error', 'mean_sparse_error', 'mean_error', 'mean_eq_error', 'mean_neq_error', 'mean_sum_error']

attributes on this instance corresponding to an error measure

algorithm

algorithm used

error_comparison_thresh = None

threshold used in the comparison error metric

mean_dense_error = None

error of this across all dense comparisons

mean_eq_error = None

error of this decomposition from equality

mean_error = None

error of this across all comparisons

mean_error_pretty()
mean_neq_error = None

error of this decomposition from inequality

mean_sparse_error = None

error of this across all sparse comparisons

mean_sum_error = None

sum of error types

num = None

number of comparisons used in evaluating all errors

num_dense = None

number of comparisons used in evaluating the dense error

num_eq = None

number of comparisons used in evaluating the equality error

num_neq = None

number of comparisons used in evaluating the inequality error

num_sparse = None

number of comparisons used in evaluating the dense error

photo

input photograph

reflectance_image

algorithm output

reset_error(save=True)
runtime = None

time taken to run in seconds

shading_image

recomputed shading image from the algorithm output

class intrinsic.models.IntrinsicPoint(*args, **kwargs)

Bases: common.models.EmptyModelBase

A point where we want to say something about relative shading, reflectance, or both, with respect to another point.

comparison_point1
comparison_point2
get_chroma()

returns rgb / sum(rgb). pure black has the same chromaticity as pure white.

get_entry_dict(include_photo=True)

Return a dictionary of this model containing just the fields needed for javascript rendering.

get_intensity()

returns mean(rgb)

get_lab()

returns the current point in L*a*b*

get_opaque_method_display(*moreargs, **morekwargs)
get_rgb()

return the color as a list

min_separation = None

at what density was this point sampled (use decimals so we can compare these with exact equality). This is converted to a distance in pixels according to

max(1, int(np.sqrt(cols ** 2 + rows ** 2) * min_separation))
opacities
opaque = None

if True: enough users voted this to be opaque (not a mirror and not transparent). if None: not yet known.

opaque_method = None

method used to set the opaque field (admin, CUBAM, or majority vote)

opaque_score = None

CUBAM score for the opaque field. higher scores indicate higher probability of being opaque. scores are thresholded at 0.

photo

photo of interest

sRGB = None

color at this point: “RRGGBB” in sRGB hex

save(*args, **kwargs)
synthetic_diff_cv = None

synthetic ground truth std(diffuse contribution) / mean(diffuse contribution), if known, and if the mean is nonzero.

synthetic_diff_fraction = None

synthetic ground truth mean(diffuse contribution) / mean(combined pixel contribution), if known. So, for fully diffuse points, this is 1.0, and for fully specular points, this is 0.0.

synthetic_diff_intensity = None

synthetic ground truth diffuse albedo intensity (mean of reflectance color channels in the diff_col layer) at this point, if known.

update_opacity(save=True)

Update the opaque field by aggregating user responses and selecting the majority vote. Note that the opaque field is updated periodically with the output of CUBAM, which is a better predictor than majority vote.

x = None

x and y are a fraction of width and height

x_aspect()

Helper for templates. Return the x pixel coordinate, scaled by height instead of width (i.e. x_aspect = x_original / height)

y = None

x and y are a fraction of width and height

class intrinsic.models.IntrinsicPointComparison(*args, **kwargs)

Bases: common.models.EmptyModelBase

Pair of points where we want to say something about their relative reflectance. The user must explain which point has a darker reflectance. To maintain unique ordering of points, point1 and point2 must be ordered so that:

point1.y < point2.y if point1.x == point2.x
point1.x < point2.x if point1.x != point2.x
DARKER_CHOICES = (('1', '1 < 2'), ('2', '1 > 1'), ('E', '1 = 2'))

darker: which point is darker

MTURK_PREFETCH = ('photo', 'point1', 'point2')

List of all ForeignKey relationships that are accessed during a mturk task. (called by mturk.utils.get_content_model_prefetch)

comparison()

Return self (helper for templates)

darker_method = None

method used to set the darker field (admin, CUBAM, or majority vote)

darker_score = None

CUBAM score for final decision

darker_score_perc()

Return the darker score as an int percentage

darker_to_str = {'1': '1 < 2', '2': '1 > 1', 'E': '1 = 2'}
expanded_bbox()
get_darker_display(*moreargs, **morekwargs)
get_darker_method_display(*moreargs, **morekwargs)
get_entry_dict()

Return a dictionary of this model containing just the fields needed for javascript rendering.

static get_thumb_template()

Return the template path for rendering thumbnails

photo

photo of interest

point1

first point in the comparison. note: point1 and point2 must be from the same photo

point1_image_darker = None

True if the luminance of the RGB pixel value at point1 is darker than that of point2

point2

second point in the comparison. note: point1 and point2 must be from the same photo

reflectance_dd = None

boolean version of the answer: if True, the darker pixel has a darker reflectance

reflectance_dd_score = None

CUBAM score for reflectance_dd

reflectance_eq = None

This is equal to darker == "E". This is used for aggregating votes with CUBAM.

reflectance_eq_score = None

CUBAM score for reflectance_eq

responses
save(*args, **kwargs)
svg_path()

Return the svg path attribute

svg_style()

Return the svg style attribute

synthetic_darker(thresh=0.05)

Return the expected/true judgement for a given threshold

synthetic_diff_intensity_ratio = None

if synthetic, the ratio (point1/point2) of the intensity of the diff_col channel (diffuse albedo) of the multilayer exr rendering. If the ground truth intensity is 0, then this is not computed.

view_box_aspect()
view_box_svg()
class intrinsic.models.IntrinsicPointComparisonResponse(*args, **kwargs)

Bases: common.models.ResultBase

A user’s answer to the comparison

comparison
confidence = None

0: guessing, 1: probably, 2: definitely

darker = None

‘1’: 1 is darker ‘2’: 2 is darker ‘E’: the points are equal

get_darker_display(*moreargs, **morekwargs)
get_next_by_added(*moreargs, **morekwargs)
get_previous_by_added(*moreargs, **morekwargs)
get_quality_method_display(*moreargs, **morekwargs)
static get_thumb_template()
mturk_assignment
static mturk_grade_test(test_content_wrappers, test_contents, results)
static mturk_submit(user, hit_contents, results, time_ms, time_active_ms, version, mturk_assignment=None, **kwargs)
reflectance_dd = None

boolean version of the answer: if True, the darker pixel has a darker reflectance

reflectance_eq = None

boolean version of the answer: stores whether darker == "E". This is used for aggregating votes with CUBAM.

user
class intrinsic.models.IntrinsicPointOpacityResponse(*args, **kwargs)

Bases: common.models.ResultBase

A user’s opinion of a point’s opacity. Note that “opaque” additionally excludes pure mirrors. In BRDF terms, opaque points have only diffuse or glossy reflection components, and no transmission component.

MTURK_PREFETCH = ('point', 'point__photo')

List of all ForeignKey relationships that are accessed during a mturk task. (called by mturk.utils.get_content_model_prefetch)

expanded_bbox()
get_next_by_added(*moreargs, **morekwargs)
get_previous_by_added(*moreargs, **morekwargs)
get_quality_method_display(*moreargs, **morekwargs)
static get_thumb_template()
mturk_assignment
static mturk_submit(user, hit_contents, results, time_ms, time_active_ms, version, mturk_assignment=None, **kwargs)
opaque = None

if True: not a mirror and not transparent. if False: either a mirror or transparent.

point

point being classified

user
view_box_svg()
zoom = None

The zoom level that the user used in the UI when deciding on opaque (1: zoomed out, larger numbers indicate zoomed in further.

class intrinsic.models.IntrinsicSyntheticDecomposition(*args, **kwargs)

Bases: common.models.EmptyModelBase

This holds the different layers of a synthetic image. The final rendered result is stored as an LDR JPG in the photo attribute, and the layers are stored in multilayer_exr. LDR preview thumbnails of each layer are stored in *_thumb.

FILE_OPTS = {'max_length': 255, 'null': True, 'storage': <common.backends.ReadOnlyS3BotoStorage object at 0x51b5910>, 'blank': True}

options for FileField or ImageField instance

depth_thumb

small LDR thumbnail of the depth layer

diff_col_thumb

small LDR thumbnail of the diffuse color (albedo) layer

diff_dir_thumb

small LDR thumbnail of the diffuse direct light layer

diff_ind_thumb

small LDR thumbnail of the diffuse indirect light layer

emit_thumb

small LDR thumbnail of the emitter layer

env_thumb

small LDR thumbnail of the environment lighting layer

gloss_col_thumb

small LDR thumbnail of the gloss color (albedo) layer

gloss_dir_thumb

small LDR thumbnail of the gloss direct light layer

gloss_ind_thumb

small LDR thumbnail of the gloss indirect light layer

md5 = None

md5 hash of the multilayer exr file

multilayer_exr

decomposition stored as a multi-layer EXR file

normal_thumb

small LDR thumbnail of the normal layer

open_multilayer_exr(**kwargs)

Open all layers from the decomposition as a dictionary See intrinsic.synthetic.open_multilayer_exr for list of arguments

open_multilayer_exr_layers(layers)

Open a set of layers from the decomposition, returned as a numpy float array (linear space)

photo

final rendered result as an LDR JPG.

scene_artist = None

name of the artist that modeled the scene

scene_url = None

URL where the scene can be found online

trans_col_thumb

small LDR thumbnail of the transparent color layer

trans_dir_thumb

small LDR thumbnail of the transparent direct light layer

trans_ind_thumb

small LDR thumbnail of the transparent indirect light layer