This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| #based on the ideas from http://synack.me/blog/implementing-http-live-streaming | |
| # Run this script and then launch the following pipeline: | |
| # gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999 | |
| from Queue import Queue | |
| from threading import Thread | |
| from socket import socket | |
| from select import select | |
| from wsgiref.simple_server import WSGIServer, make_server, WSGIRequestHandler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import functools | |
| def my_collate(batch, use_shared_memory=False): | |
| r"""Puts each data field into a tensor with outer dimension batch size""" | |
| error_msg = "batch must contain tensors, numbers, dicts or lists; found {}" | |
| elem_type = type(batch[0]) | |
| if isinstance(batch[0], torch.Tensor): | |
| out = None | |
| if use_shared_memory: |