This media_reporting.py example demonstrates reporting (uploading) audio and video media, from a source by URL (already uploaded to some location), or in a local file. Trains reports these HTML debug samples in the Trains Web (UI), experiment details, RESULTS tab, DEBUG SAMPLES sub-tab. When the script runs, it creates an experiment named audio and video reporting, which is associated with the examples project.
Report by calling the Logger.report_media method and specify the media using one of the following parameters:
- local_path - Image file.
- stream and file_extension - BytesIO stream.
- url - A URL for the location of a pre-uploaded image.
Reporting (uploading) media from a source by URL
Report by calling the Logger.report_media method using the url parameter.
# 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') # 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')
Reporting (uploading) media from a local file
Use the local_path parameter.
# report audio, report local media audio file Logger.current_logger().report_media( 'audio', 'tada', iteration=1, local_path=os.path.join('data_samples', 'sample.mp3'))