module: photos.models

class photos.models.FlickrUser(*args, **kwargs)

Bases: common.models.EmptyModelBase

Flickr user

blacklisted = None

if true, this user has too many bogus photos and will be ignored

photos
username = None

flickr username

class photos.models.Photo(*args, **kwargs)

Bases: common.models.UserBase

Photograph

DEFAULT_FILTERS = {'synthetic': False, 'stylized': False, 'license__creative_commons': True, 'nonperspective': False, 'inappropriate': False, 'scene_category_correct_score__isnull': False, 'rotated': False, 'scene_category_correct': True}

Default filters for views

aspect_ratio = None

width/height aspect ratio

attribution_name = None

name of photographer or source, if not a Flickr user

best_intrinsic_images_decompositions()
description = None

optional user description

exif = None

exif data (output from jhead)

flickr_id = None

flickr photo id

flickr_user

flickr user that uploaded this photo

focal_y = None

focal length in units of height (focal_pixels = height * focal_y)

font_adjustment_512()

Helper for svg templates

font_size_512()

Helper for svg templates: return the font size that should be used to render an image with width 512px, when in an SVG environment that has the height scaled to 1.0 units

fov = None

field of view in degrees of the longer dimension

get_absolute_url(*moreargs, **morekwargs)
get_entry_dict()

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

get_flickr_url()
get_next_by_added(*moreargs, **morekwargs)
get_pixel(x, y, width='orig')

Fetch a pixel, in floating point coordinates (x and y range from 0.0 inclusive to 1.0 exclusive), at a given resolution (specified by width)

get_previous_by_added(*moreargs, **morekwargs)
get_scene_category_correct_method_display(*moreargs, **morekwargs)
static get_thumb_template()
height_1024()

Helper for templates: return the image height when the width is 1024

height_512()

Helper for templates: return the image height when the width is 512

image_1024 = <imagekit.models.fields.ImageSpecField object at 0x4980450>

The photograph resized to fit inside the rectangle 1024 x 2048

image_200 = <imagekit.models.fields.ImageSpecField object at 0x4833890>

The photograph resized to fit inside the rectangle 200 x 400

image_2048 = <imagekit.models.fields.ImageSpecField object at 0x4980590>

The photograph resized to fit inside the rectangle 2048 x 4096

image_300 = <imagekit.models.fields.ImageSpecField object at 0x49801d0>

The photograph resized to fit inside the rectangle 300 x 600

image_512 = <imagekit.models.fields.ImageSpecField object at 0x4980310>

The photograph resized to fit inside the rectangle 512 x 1024

image_height(width)

Returns the height of image_<width>

image_orig

original uploaded image (jpg format)

image_square_300 = <imagekit.models.fields.ImageSpecField object at 0x49806d0>

The photograph cropped (and resized) to fit inside the square 300 x 300

in_iiw_dataset = None

if True, this is part of the IIW (“Intrinsic Images in the Wild” paper) dataset.

in_iiw_dense_dataset = None

if True, this is part of the IIW (“Intrinsic Images in the Wild” paper) dense dataset.

inappropriate = None

If True, this photo contains sexual content. If None, this photo has not been examined for this attribute. This field is set by admins, not workers, by visually judging the image. (this is not a limitation; we just didn’t think to make this a task until late in the project)

intrinsic_circle_size()
intrinsic_comparisons
intrinsic_densities()
intrinsic_images_decompositions
intrinsic_points
intrinsic_synthetic
license

copyright license

light_stack

the light stack that this photo is part of (most photos will not be part of one)

material_shapes
md5 = None

hash for simple duplicate detection

median_intrinsic_error = None

median intrinsic images error

nonperspective = None

If True, this photo was NOT taken with a perspective lens (e.g. fisheye). If None, this photo has not been examined for this attribute. This field is set by admins, not workers, by visually judging the image. (this is not a limitation; we just didn’t think to make this a task until late in the project)

num_intrinsic_comparisons = None

cache of the number of intrinsic comparisons with nonzero score

num_intrinsic_points = None

cache of the number of intrinsic points (all points)

num_shapes = None

cache of the number of correct material shapes for this photo (useful optimization when sorting by this count). These values are updated by the celery task photos.tasks.update_photos_num_shapes()

num_vertices = None

cache of the number of vertices in all correct material shapes for this photo (useful optimization when sorting by this count). These values are updated by the celery task photos.tasks.update_photos_num_shapes()

open_image(width='orig')

Fetch the image at a given size (see the image_<width> fields)

orig_height = None

height of image_orig

orig_width = None

width of image_orig

publishable()

True if the license exists and has publishable=True

publishable_score()

Return a score indicating how ‘open’ the photo license is

rotated = None

If True, this photo is incorrectly rotated (tilt about the center). looking up or down does not count as ‘rotated’. This label is subjective; the image has to be tilted by more than 30 degrees to be labeled ‘rotated’. The label is mostly intended to capture images that are clearly 90 degrees from correct. If None, this photo has not been examined for this attribute. This field is set by admins, not workers, by visually judging the image. (this is not a limitation; we just didn’t think to make this a task until late in the project)

save(*args, **kwargs)
scene_category

scene, e.g. “bathroom”, “living room”

scene_category_correct = None

if true, the scene category is valid; null: unknown

scene_category_correct_method = None

method used to set scene_category_correct

scene_category_correct_score = None

further from 0: more confident in assignment of scene_category_correct

scene_qualities
stylized = None

Tf True, this photo does not represent what the scene really looks like from a pinhole camera. For example, it may have been visibly edited or is obviously HDR, or has low quality, high noise, excessive blur, excessive defocus, visible vignetting, long exposure effects, text overlays, timestamp overlays, black/white borders, washed out colors, sepia tone or black/white, infrared filter, very distorted tones (note that whitebalanced is a separate field), or some other effect.

If None, this photo has not been examined for this attribute. This field is set by admins, not workers, by visually judging the image. (this is not a limitation; we just didn’t think to make this a task until late in the project)

submitted_shapes
synthetic = None

if true, this is synthetic or otherwise manually inserted for special experiments.

user
valid_material_shapes()
vanishing_length = None

Sum of the length of all vanishing line segments (vanishing_lines).

vanishing_lines = None

This is not “vanishing lines” in the sense that it is an infinite line passing through the vanishing point. Rather, this is a list of line segments detected in the image, classified as likely passing through a certain vanishing point.

json-encoded list of groups. Each group: list of lines. Each line: x1, y1, x2, y2 normalized by width and height. The groups are stored in order of decreasing size.

vanishing_lines_svg_path()

Generator for all vanishing line segments as SVG path data

vanishing_point_to_vector(v, focal_y=None)

Return the 3D unit vector corresponding to a vanishing point (specified in normalized coordinates)

vanishing_points = None

Vanishing points, json-encoded. Format: list of normalized (x, y) tuples.

vanishing_points_enumerate()

Return the vanishing points as an enumerated python list

vanishing_uvn_matrices(focal_y=None)
vanishing_uvn_matrices_json(focal_y=None)
vanishing_vectors(focal_y=None)

Returns vanishing points as unit vectors (converted to tuples for compatibility with templates)

vanishing_vectors_enumerate()

Return the vanishing vectors as an enumerated python list

vector_to_vanishing_point(v, focal_y=None)

Return the 2D vanishing point (in normalized coordinates) corresponding to 3D vector

whitebalanced = None

if true, this photo is whitebalanced; null: unknown

whitebalanced_score = None

further from 0: more confident in assignment of whitebalanced

whitebalances
class photos.models.PhotoLabelBase(*args, **kwargs)

Bases: common.models.ResultBase

Abstract parent for photo labels

class Meta
abstract = False
ordering = ['photo', '-time_ms']
PhotoLabelBase.get_next_by_added(*moreargs, **morekwargs)
PhotoLabelBase.get_previous_by_added(*moreargs, **morekwargs)
PhotoLabelBase.get_quality_method_display(*moreargs, **morekwargs)
PhotoLabelBase.get_thumb_overlay()
static PhotoLabelBase.get_thumb_template()
PhotoLabelBase.mturk_assignment
PhotoLabelBase.save(*args, **kwargs)
PhotoLabelBase.user
class photos.models.PhotoLightStack(*args, **kwargs)

Bases: common.models.EmptyModelBase

A collection of photos that are of an identical scene and viewpoint, but with different lighting conditions

photos
class photos.models.PhotoSceneCategory(*args, **kwargs)

Bases: common.models.EmptyModelBase

Scene category, such as ‘kitchen’, ‘bathroom’, ‘living room’

description = None

Text description of this category

name = None

Scene category name

name_capitalized()
parent

“Parent” category. Scene categories can be nested in a tree. Currently none are.

photo_count(**filters)
photos
photoscenecategory_set
class photos.models.PhotoSceneQualityLabel(*args, **kwargs)

Bases: photos.models.PhotoLabelBase

Label indicating whether a photo’s scene category is correct.

get_next_by_added(*moreargs, **morekwargs)
get_previous_by_added(*moreargs, **morekwargs)
get_quality_method_display(*moreargs, **morekwargs)
get_thumb_overlay()
mturk_assignment
static mturk_submit(user, hit_contents, results, time_ms, time_active_ms, version, mturk_assignment=None, **kwargs)
photo
user
class photos.models.PhotoWhitebalanceLabel(*args, **kwargs)

Bases: photos.models.PhotoLabelBase

List of points in an image that should have zero chromaticity.

chroma_median = None

Median 2-norm of the a,b channel in L*a*b*, null if num_points = 0

get_next_by_added(*moreargs, **morekwargs)
get_points_aspect()

Returns the points with the x coordinate scaled to have the correct aspect ratio

get_previous_by_added(*moreargs, **morekwargs)
get_quality_method_display(*moreargs, **morekwargs)
get_thumb_overlay()
mturk_assignment
static mturk_submit(user, hit_contents, results, time_ms, time_active_ms, version, mturk_assignment=None, **kwargs)
num_points = None

number of points

photo

photo for this whitebalance label

points = None

Point format: x1,y1,x2,y2 as a fraction of width,height

save(*args, **kwargs)
user