Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tensorboard/plugins/image/http_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ which is an object with the following items:

- `"wall_time"`: floating-point number of seconds since epoch.
- `"step"`: integer step counter.
- `"width"`: integer width of the image, in pixels.
- `"height"`: integer height of the image, in pixels.
- `"query"`: query string that can be given to the `individualImage`
route (below) to serve the actual image content. This string must be
treated as opaque: clients must not inspect or modify its value.

Here is an example response:

[{
"width": 28,
"height": 28,
"wall_time": 1440210599.246,
"step": 63702821,
"query": "index=0&sample=0&tagname=input%2Fimage%2F2&run=train"
Expand Down
19 changes: 4 additions & 15 deletions tensorboard/plugins/image/images_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,16 @@ def _image_response_for_run(self, run, tag, sample):
fewer than three images will be omitted from the results.

Returns:
A list of dictionaries containing the wall time, step, URL, width, and
height for each image.
A list of dictionaries containing the wall time, step, and URL
for each image.
"""
if self._db_connection_provider:
db = self._db_connection_provider()
cursor = db.execute(
"""
SELECT
computed_time,
step,
CAST (T0.data AS INT) AS width,
CAST (T1.data AS INT) AS height
step
FROM Tensors
JOIN TensorStrings AS T0
ON Tensors.rowid = T0.tensor_rowid
Expand All @@ -239,30 +237,21 @@ def _image_response_for_run(self, run, tag, sample):
{
"wall_time": computed_time,
"step": step,
"width": width,
"height": height,
"query": self._query_for_individual_image(
run, tag, sample, index
),
}
for index, (computed_time, step, width, height) in enumerate(
cursor
)
for index, (computed_time, step) in enumerate(cursor)
]
response = []
index = 0
tensor_events = self._multiplexer.Tensors(run, tag)
filtered_events = self._filter_by_sample(tensor_events, sample)
for (index, tensor_event) in enumerate(filtered_events):
(width, height) = tensor_event.tensor_proto.string_val[:2]
response.append(
{
"wall_time": tensor_event.wall_time,
"step": tensor_event.step,
# We include the size so that the frontend can add that to the <img>
# tag so that the page layout doesn't change when the image loads.
"width": int(width),
"height": int(height),
"query": self._query_for_individual_image(
run, tag, sample, index
),
Expand Down
8 changes: 0 additions & 8 deletions tensorboard/plugins/image/images_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ def testOldStyleImagesRoute(self):

# Verify that the 1st entry is correct.
entry = entries[0]
self.assertEqual(42, entry["width"])
self.assertEqual(16, entry["height"])
self.assertEqual(0, entry["step"])
parsed_query = urllib.parse.parse_qs(entry["query"])
self.assertListEqual(["foo"], parsed_query["run"])
Expand All @@ -158,8 +156,6 @@ def testOldStyleImagesRoute(self):

# Verify that the 2nd entry is correct.
entry = entries[1]
self.assertEqual(42, entry["width"])
self.assertEqual(16, entry["height"])
self.assertEqual(1, entry["step"])
parsed_query = urllib.parse.parse_qs(entry["query"])
self.assertListEqual(["foo"], parsed_query["run"])
Expand All @@ -180,8 +176,6 @@ def testNewStyleImagesRoute(self):

# Verify that the 1st entry is correct.
entry = entries[0]
self.assertEqual(6, entry["width"])
self.assertEqual(8, entry["height"])
self.assertEqual(0, entry["step"])
parsed_query = urllib.parse.parse_qs(entry["query"])
self.assertListEqual(["bar"], parsed_query["run"])
Expand All @@ -191,8 +185,6 @@ def testNewStyleImagesRoute(self):

# Verify that the 2nd entry is correct.
entry = entries[1]
self.assertEqual(6, entry["width"])
self.assertEqual(8, entry["height"])
self.assertEqual(1, entry["step"])
parsed_query = urllib.parse.parse_qs(entry["query"])
self.assertListEqual(["bar"], parsed_query["run"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@
},

// steps: {
// width: number,
// height: number,
// wall_time: Date,
// step: number,
// url: string,
Expand Down Expand Up @@ -363,8 +361,6 @@
url += '&' + imageMetadata.query;

return {
width: imageMetadata.width,
height: imageMetadata.height,
// The wall time within the metadata is in seconds. The Date
// constructor accepts a time in milliseconds, so we multiply by 1000.
wall_time: new Date(imageMetadata.wall_time * 1000),
Expand Down