SourceTypes
LoadStreams
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__init__(sources='file.streams', imgsz=640, vid_stride=1)
Initialize instance variables and check for consistent input stream shapes.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__iter__()
__len__()
__next__()
Returns source paths, transformed and original images for processing YOLOv5.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
update(i, cap, stream)
Read stream i
frames in daemon thread.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
LoadScreenshots
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__init__(source, imgsz=640)
source = [screen_number left top width height] (pixels).
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__iter__()
__next__()
mss screen capture: get raw pixels from the screen as np array.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
LoadImages
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
__init__(path, imgsz=640, vid_stride=1)
Initialize the Dataloader and raise FileNotFoundError if file not found.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__iter__()
__len__()
__next__()
Return next image, path and metadata from dataset.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
LoadPilAndNumpy
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__init__(im0, imgsz=640)
Initialize PIL and Numpy Dataloader.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__iter__()
__len__()
__next__()
Returns batch paths, images, processed images, None, ''.
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
LoadTensor
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
__iter__()
__len__()
__next__()
Return next item in the iterator.
autocast_list
Merges a list of source of different types into a list of numpy arrays or PIL images
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
get_best_youtube_url
Retrieves the URL of the best quality MP4 video stream from a given YouTube video.
This function uses the pafy or yt_dlp library to extract the video info from YouTube. It then finds the highest quality MP4 format that has video codec but no audio codec, and returns the URL of this video stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
The URL of the YouTube video. |
required |
use_pafy |
bool
|
Use the pafy package, default=True, otherwise use yt_dlp package. |
True
|
Returns:
Type | Description |
---|---|
str
|
The URL of the best quality MP4 video stream, or None if no suitable stream is found. |
Source code in ultralytics/yolo/data/dataloaders/stream_loaders.py
Created 2023-04-16, Updated 2023-05-30
Authors: Glenn Jocher (4)