Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: gm/rebaseline_server/results.py

Issue 147453003: Add the perceptual difference metric to the rebaseline server (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address feedback Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/rebaseline_server/imagediffdb_test.py ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
10 """ 10 """
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if expectations_per_test: 425 if expectations_per_test:
426 for field in FIELDS_PASSED_THRU_VERBATIM: 426 for field in FIELDS_PASSED_THRU_VERBATIM:
427 results_for_this_test[field] = expectations_per_test.get(field) 427 results_for_this_test[field] = expectations_per_test.get(field)
428 428
429 if updated_result_type == gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON: 429 if updated_result_type == gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON:
430 pass # no diff record to calculate at all 430 pass # no diff record to calculate at all
431 elif updated_result_type == gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED: 431 elif updated_result_type == gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED:
432 results_for_this_test['numDifferingPixels'] = 0 432 results_for_this_test['numDifferingPixels'] = 0
433 results_for_this_test['percentDifferingPixels'] = 0 433 results_for_this_test['percentDifferingPixels'] = 0
434 results_for_this_test['weightedDiffMeasure'] = 0 434 results_for_this_test['weightedDiffMeasure'] = 0
435 results_for_this_test['perceptualDifference'] = 0
435 results_for_this_test['maxDiffPerChannel'] = 0 436 results_for_this_test['maxDiffPerChannel'] = 0
436 else: 437 else:
437 try: 438 try:
438 diff_record = self._image_diff_db.get_diff_record( 439 diff_record = self._image_diff_db.get_diff_record(
439 expected_image_locator=expected_image[1], 440 expected_image_locator=expected_image[1],
440 actual_image_locator=actual_image[1]) 441 actual_image_locator=actual_image[1])
441 results_for_this_test['numDifferingPixels'] = ( 442 results_for_this_test['numDifferingPixels'] = (
442 diff_record.get_num_pixels_differing()) 443 diff_record.get_num_pixels_differing())
443 results_for_this_test['percentDifferingPixels'] = ( 444 results_for_this_test['percentDifferingPixels'] = (
444 diff_record.get_percent_pixels_differing()) 445 diff_record.get_percent_pixels_differing())
445 results_for_this_test['weightedDiffMeasure'] = ( 446 results_for_this_test['weightedDiffMeasure'] = (
446 diff_record.get_weighted_diff_measure()) 447 diff_record.get_weighted_diff_measure())
448 results_for_this_test['perceptualDifference'] = (
449 diff_record.get_perceptual_difference())
447 results_for_this_test['maxDiffPerChannel'] = ( 450 results_for_this_test['maxDiffPerChannel'] = (
448 diff_record.get_max_diff_per_channel()) 451 diff_record.get_max_diff_per_channel())
449 except KeyError: 452 except KeyError:
450 logging.warning('unable to find diff_record for ("%s", "%s")' % 453 logging.warning('unable to find diff_record for ("%s", "%s")' %
451 (expected_image[1], actual_image[1])) 454 (expected_image[1], actual_image[1]))
452 pass 455 pass
453 456
454 Results._add_to_category_dict(categories_all, results_for_this_test) 457 Results._add_to_category_dict(categories_all, results_for_this_test)
455 data_all.append(results_for_this_test) 458 data_all.append(results_for_this_test)
456 459
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 help='Directory within which to download images and generate diffs') 536 help='Directory within which to download images and generate diffs')
534 args = parser.parse_args() 537 args = parser.parse_args()
535 results = Results(actuals_root=args.actuals, 538 results = Results(actuals_root=args.actuals,
536 expected_root=args.expectations, 539 expected_root=args.expectations,
537 generated_images_root=args.workdir) 540 generated_images_root=args.workdir)
538 gm_json.WriteToFile(results.get_results_of_type(RESULTS_ALL), args.outfile) 541 gm_json.WriteToFile(results.get_results_of_type(RESULTS_ALL), args.outfile)
539 542
540 543
541 if __name__ == '__main__': 544 if __name__ == '__main__':
542 main() 545 main()
OLDNEW
« no previous file with comments | « gm/rebaseline_server/imagediffdb_test.py ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698