2021-05-13 23:48:51 +00:00
|
|
|
---
|
|
|
|
title: Media Reporting
|
|
|
|
---
|
|
|
|
|
|
|
|
The [media_reporting.py](https://github.com/allegroai/clearml/blob/master/examples/reporting/media_reporting.py) example
|
2024-08-05 07:12:18 +00:00
|
|
|
demonstrates reporting (uploading) images, audio, and video. Use [`Logger.report_media()`](../../references/sdk/logger.md#report_media)
|
|
|
|
to upload from:
|
2021-05-13 23:48:51 +00:00
|
|
|
* Local path
|
|
|
|
* BytesIO stream
|
|
|
|
* URL of media already uploaded to some storage
|
|
|
|
|
2024-08-05 07:12:18 +00:00
|
|
|
ClearML uploads media to the bucket specified in the ClearML configuration file. You can configure ClearML for image
|
|
|
|
storage using [`Logger.set_default_upload_destination()`](../../references/sdk/logger.md#set_default_upload_destination)
|
|
|
|
(note that [artifact storage](../../clearml_sdk/task_sdk.md#setting-upload-destination) is handled differently).
|
|
|
|
Set the storage credentials in the [clearml.conf file](../../configs/clearml_conf.md#sdk-section).
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2022-05-22 07:27:30 +00:00
|
|
|
ClearML reports media in the **ClearML Web UI** **>** experiment details **>** **DEBUG SAMPLES**
|
|
|
|
tab.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-09-04 12:40:42 +00:00
|
|
|
When the script runs, it creates an experiment named `audio and video reporting` in the `examples`
|
2021-05-13 23:48:51 +00:00
|
|
|
project.
|
|
|
|
|
2021-09-09 10:17:46 +00:00
|
|
|
## Reporting (Uploading) Media from a Source by URL
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2024-08-05 07:12:18 +00:00
|
|
|
Report by using the `url` parameter of [`Logger.report_media()`](../../references/sdk/logger.md#report_media):
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-12-14 13:12:30 +00:00
|
|
|
```python
|
|
|
|
# report video, an already uploaded video media (url)
|
|
|
|
Logger.current_logger().report_media(
|
|
|
|
'video', 'big bunny', iteration=1,
|
|
|
|
url='https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/720/Big_Buck_Bunny_720_10s_1MB.mp4'
|
|
|
|
)
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-12-14 13:12:30 +00:00
|
|
|
# report audio, report an already uploaded audio media (url)
|
|
|
|
Logger.current_logger().report_media(
|
|
|
|
'audio', 'pink panther', iteration=1,
|
|
|
|
url='https://www2.cs.uic.edu/~i101/SoundFiles/PinkPanther30.wav'
|
|
|
|
)
|
|
|
|
```
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-10-02 15:32:39 +00:00
|
|
|
The reported audio can be viewed in the **DEBUG SAMPLES** tab. Click a thumbnail to open the audio player.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-10-02 15:32:39 +00:00
|
|
|
![Audio debug samples](../../img/examples_reporting_08.png)
|
2021-05-13 23:48:51 +00:00
|
|
|
|
|
|
|
|
2021-09-09 10:17:46 +00:00
|
|
|
## Reporting (Uploading) Media from a Local File
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2024-08-05 07:12:18 +00:00
|
|
|
Report by using the `local_path` parameter of [`Logger.report_media()`](../../references/sdk/logger.md#report_media):
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-12-14 13:12:30 +00:00
|
|
|
```python
|
|
|
|
# report audio, report local media audio file
|
|
|
|
Logger.current_logger().report_media(
|
2024-03-06 13:00:50 +00:00
|
|
|
title='audio',
|
|
|
|
series='tada',
|
|
|
|
iteration=1,
|
2021-12-14 13:12:30 +00:00
|
|
|
local_path=os.path.join('data_samples', 'sample.mp3')
|
|
|
|
)
|
|
|
|
```
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-10-02 15:32:39 +00:00
|
|
|
The reported video can be viewed in the **DEBUG SAMPLES** tab. Click a thumbnail to open the video player.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-10-02 15:32:39 +00:00
|
|
|
![Video debug samples](../../img/examples_reporting_09.png)
|