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

Issue 668753002: [Telemetry] Migrate bitmap.py from bitmaptools.cc to numpy (Closed)

Created:
6 years, 2 months ago by mthiesse
Modified:
5 years, 11 months ago
CC:
chromium-reviews, darin-cc_chromium.org, telemetry+watch_chromium.org, jam, piman+watch_chromium.org, Daniel Sievers (Google), vmpstr
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

[Telemetry] Migrate bitmap.py from bitmaptools.cc to openCV Some measurements from my testing: Diff is ~8700x as fast.(!!!) IsEqual is ~1400x as fast when tolerance is specified.(!) FromPngFile is ~100x as fast HistogramDistance is ~2x as fast ColorHistogram is ~4x as fast GetBoundingBox is ~3x as fast BUG=425299, 437525 Committed: https://crrev.com/cc2f73e5c07adf639755d621155e4653863887a5 Cr-Commit-Position: refs/heads/master@{#308842}

Patch Set 1 : Initial Review #

Patch Set 2 : Simplify FromRGBPixels #

Total comments: 39

Patch Set 3 : Address comments #

Total comments: 2

Patch Set 4 : Make GetBoundingBox just, like, WAY too fast #

Total comments: 7

Patch Set 5 : address comments #

Patch Set 6 : sync #

Patch Set 7 : Make OpenCV dependency optional #

Patch Set 8 : rebase #

Patch Set 9 : Move bitmap.py behind interface, all dependencies optional. #

Patch Set 10 : Small fixes + updated some comments #

Patch Set 11 : rebase + fix test #

Patch Set 12 : Fail import on missing dependency #

Patch Set 13 : fix imports #

Patch Set 14 : fix gpu_tests #

Patch Set 15 : Remove base CL dependency #

Patch Set 16 : More gpu_tests fixes #

Total comments: 8

Patch Set 17 : Add faster openCV implementation back, dependent on opencv being present #

Patch Set 18 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+775 lines, -783 lines) Patch
M content/test/gpu/gpu_tests/cloud_storage_test_base.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 chunks +14 lines, -12 lines 0 comments Download
M content/test/gpu/gpu_tests/gpu_rasterization.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +5 lines, -4 lines 0 comments Download
M content/test/gpu/gpu_tests/maps.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +1 line, -2 lines 0 comments Download
M content/test/gpu/gpu_tests/pixel.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +7 lines, -7 lines 0 comments Download
M tools/perf/measurements/screenshot.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -1 line 0 comments Download
M tools/perf/metrics/speedindex.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +9 lines, -6 lines 0 comments Download
M tools/perf/metrics/speedindex_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +10 lines, -8 lines 0 comments Download
A + tools/telemetry/telemetry/core/_bitmap.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 10 chunks +13 lines, -130 lines 0 comments Download
M tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +2 lines, -2 lines 0 comments Download
M tools/telemetry/telemetry/core/backends/webdriver/webdriver_tab_backend.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M tools/telemetry/telemetry/core/bitmap.py View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -353 lines 0 comments Download
D tools/telemetry/telemetry/core/bitmap_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -239 lines 0 comments Download
M tools/telemetry/telemetry/core/tab_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +14 lines, -10 lines 0 comments Download
M tools/telemetry/telemetry/core/video.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +8 lines, -6 lines 0 comments Download
M tools/telemetry/telemetry/core/video_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +2 lines, -2 lines 0 comments Download
A + tools/telemetry/telemetry/image_processing/__init__.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 chunks +-1 lines, --1 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/histogram.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +67 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/histogram_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +117 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/image_util.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +114 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +50 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/image_util_numpy_impl.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +183 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/image_util_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +123 lines, -0 lines 0 comments Download
A tools/telemetry/telemetry/image_processing/rgba_color.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +33 lines, -0 lines 0 comments Download

Messages

Total messages: 51 (20 generated)
mthiesse
Hi Rob, Tony, szym@ PTAL. I was hoping to get rid of the dependency on ...
6 years, 2 months ago (2014-10-21 14:53:18 UTC) #7
tonyg
Overall this looks great. Just a few minor things and I think this'll be ready ...
6 years, 2 months ago (2014-10-21 16:12:57 UTC) #10
mthiesse
https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py#newcode220 tools/telemetry/telemetry/core/bitmap.py:220: def ColorHistogram(self, ignore_color=None, tolerance=0): On 2014/10/21 16:12:56, tonyg wrote: ...
6 years, 2 months ago (2014-10-21 18:40:58 UTC) #11
tonyg
On 2014/10/21 18:40:58, mthiesse wrote: > https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py > File tools/telemetry/telemetry/core/bitmap.py (right): > > https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py#newcode220 > ...
6 years, 2 months ago (2014-10-21 19:06:29 UTC) #13
flackr
Just a few comments. https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py#newcode195 tools/telemetry/telemetry/core/bitmap.py:195: top = 1e16 When possible, ...
6 years, 2 months ago (2014-10-21 21:50:11 UTC) #14
slamm
A few style suggestions. https://codereview.chromium.org/668753002/diff/140001/content/test/gpu/gpu_tests/cloud_storage_test_base.py File content/test/gpu/gpu_tests/cloud_storage_test_base.py (right): https://codereview.chromium.org/668753002/diff/140001/content/test/gpu/gpu_tests/cloud_storage_test_base.py#newcode40 content/test/gpu/gpu_tests/cloud_storage_test_base.py:40: expectation["color"][2]) Nit. Follow style-guide for ...
6 years, 2 months ago (2014-10-21 23:21:58 UTC) #16
mthiesse
https://codereview.chromium.org/668753002/diff/140001/content/test/gpu/gpu_tests/cloud_storage_test_base.py File content/test/gpu/gpu_tests/cloud_storage_test_base.py (right): https://codereview.chromium.org/668753002/diff/140001/content/test/gpu/gpu_tests/cloud_storage_test_base.py#newcode12 content/test/gpu/gpu_tests/cloud_storage_test_base.py:12: import cv2 On 2014/10/21 16:12:56, tonyg wrote: > Nit: ...
6 years, 2 months ago (2014-10-22 15:33:10 UTC) #17
slamm
https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/140001/tools/telemetry/telemetry/core/bitmap.py#newcode16 tools/telemetry/telemetry/core/bitmap.py:16: import numpy as np On 2014/10/22 15:33:10, mthiesse wrote: ...
6 years, 2 months ago (2014-10-22 16:41:22 UTC) #18
flackr
lgtm
6 years, 2 months ago (2014-10-22 19:03:39 UTC) #19
tonyg
lgtm (once this works across platforms)
6 years, 2 months ago (2014-10-22 19:35:22 UTC) #20
slamm
lgtm. BTW, at one point, Pat compared different histogram distance algorithms. The earth movers algorithm ...
6 years, 2 months ago (2014-10-22 21:15:50 UTC) #21
szym
overall lgtm The new BoundingBox code is much slower (a plain python loop over all ...
6 years, 2 months ago (2014-10-23 05:56:43 UTC) #22
slamm
https://codereview.chromium.org/668753002/diff/160001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/160001/tools/telemetry/telemetry/core/bitmap.py#newcode210 tools/telemetry/telemetry/core/bitmap.py:210: if ColorsAreEqual(img[y][x], color, tolerance): Short of the alternatives @symn ...
6 years, 2 months ago (2014-10-23 17:46:33 UTC) #23
mthiesse
Great suggestions szym, I guess I didn't realize just how slow python was :P Ran ...
6 years, 2 months ago (2014-10-23 21:51:51 UTC) #25
slamm
Nice! https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py#newcode198 tools/telemetry/telemetry/core/bitmap.py:198: Ignores the alpha channel.""" Would you update the ...
6 years, 2 months ago (2014-10-23 22:57:44 UTC) #26
szym
https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py#newcode204 tools/telemetry/telemetry/core/bitmap.py:204: contours, _ = cv2.findContours(img, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE) On 2014/10/23 22:57:44, ...
6 years, 2 months ago (2014-10-23 23:17:07 UTC) #28
mthiesse
https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py File tools/telemetry/telemetry/core/bitmap.py (right): https://codereview.chromium.org/668753002/diff/200001/tools/telemetry/telemetry/core/bitmap.py#newcode198 tools/telemetry/telemetry/core/bitmap.py:198: Ignores the alpha channel.""" On 2014/10/23 22:57:44, slamm wrote: ...
6 years, 2 months ago (2014-10-24 14:48:12 UTC) #29
slamm
lgtm
6 years, 1 month ago (2014-10-27 16:32:32 UTC) #30
mthiesse
This may warrant another look, I've made the openCV dependency in this CL optional, replacing ...
6 years ago (2014-11-26 22:24:16 UTC) #31
mthiesse
Alright, now this definitely requires another look :) I've made all dependencies optional by moving ...
6 years ago (2014-12-09 16:55:09 UTC) #33
slamm
On 2014/12/09 16:55:09, mthiesse wrote: > Alright, now this definitely requires another look :) > ...
6 years ago (2014-12-16 22:09:42 UTC) #36
mthiesse
+kbr for content/test/gpu/ OWNERS
6 years ago (2014-12-16 22:14:51 UTC) #38
Ken Russell (switch to Gerrit)
LGTM overall. Please document somewhere exactly what the requirements are to take the new code ...
6 years ago (2014-12-16 23:41:47 UTC) #39
achuithb
There's a good chance this will also break on cros.
6 years ago (2014-12-17 02:34:40 UTC) #41
szym
lgtm https://codereview.chromium.org/668753002/diff/490001/tools/telemetry/telemetry/image_processing/image_util_impl.py File tools/telemetry/telemetry/image_processing/image_util_impl.py (right): https://codereview.chromium.org/668753002/diff/490001/tools/telemetry/telemetry/image_processing/image_util_impl.py#newcode123 tools/telemetry/telemetry/image_processing/image_util_impl.py:123: w = np.where(((b >= colorm[0]) & (b <= ...
6 years ago (2014-12-17 05:15:26 UTC) #42
mthiesse
https://codereview.chromium.org/668753002/diff/490001/tools/telemetry/telemetry/core/video.py File tools/telemetry/telemetry/core/video.py (right): https://codereview.chromium.org/668753002/diff/490001/tools/telemetry/telemetry/core/video.py#newcode9 tools/telemetry/telemetry/core/video.py:9: from telemetry.image_processing import image_util On 2014/12/16 23:41:47, Ken Russell ...
6 years ago (2014-12-17 16:56:10 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/668753002/510001
6 years ago (2014-12-17 16:58:46 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: android_aosp on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/builds/42922) android_arm64_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_arm64_dbg_recipe/builds/31629) android_chromium_gn_compile_dbg ...
6 years ago (2014-12-17 17:03:54 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/668753002/530001
6 years ago (2014-12-17 17:41:09 UTC) #49
commit-bot: I haz the power
Committed patchset #18 (id:530001)
6 years ago (2014-12-17 19:40:27 UTC) #50
commit-bot: I haz the power
6 years ago (2014-12-17 19:41:03 UTC) #51
Message was sent while issue was closed.
Patchset 18 (id:??) landed as
https://crrev.com/cc2f73e5c07adf639755d621155e4653863887a5
Cr-Commit-Position: refs/heads/master@{#308842}

Powered by Google App Engine
This is Rietveld 408576698