Viame Manual Annotation Tools
construct_image_filename_from_video_frame(video_filename, time, outfile_format, outfile_dir)
construct a filename from a given video file and frame time
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video_filename
|
str
|
the file name of the video. This will be formatted into the
outfile_format as |
required |
time
|
time
|
the time that locates the desired frame in the video |
required |
outfile_format
|
str | None
|
if None, defaults to '{video_filename}.%H.%M.%S.%f.jpg'
|
required |
outfile_dir
|
str | None
|
if not None, this is simply path joined to the filename output |
required |
Returns:
| Name | Type | Description |
|---|---|---|
frame_filename |
str
|
a filename appropriate for the specified frame in the video |
Source code in viame2coco/viame_manual_annotations.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
extract_frame_microseconds(cv2_video_cap, microseconds, outfile=None)
extract a frame from the provided cv2 video at the given number of microseconds. Optionally write the frame to outfile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cv2_video_cap
|
VideoCapture
|
the video from which to capture the frame |
required |
microseconds
|
float
|
the location in microseconds into the video at which to extract the desired frame |
required |
outfile
|
str | None
|
the optional filename to which the desired frame should be writ |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
image |
ndarray | None
|
the video frame at the given number of microseconds, or None
if the frame read was unsuccessful. Additionally, the frame
may be written to a file as a side-effect if |
Source code in viame2coco/viame_manual_annotations.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
extract_viame_video_annotations(viame_csv, video_file, outfile_format=None, outfile_dir=None)
extract the manual annotations and frames from a VIAME-style annotaiton csv
Writes the frames to files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viame_csv
|
Iterable[Sequence]
|
the data rows from a VIAME-style annotation csv should not include the headers |
required |
video_file
|
str
|
the file name of the video. This will be formatted into the
outfile_format as |
required |
outfile_format
|
str | None
|
see |
None
|
outfile_dir
|
str | None
|
see |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
viame_csv |
Iterable[Sequence]
|
the data rows in the input only when the annotations are manual, skipping any automated annotations |
Source code in viame2coco/viame_manual_annotations.py
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 | |
filter_viame_manual_annotations(viame_csv)
filters an iterable of data rows read from a VIAME-style annotation csv to only rows that contain manual annotations
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viame_csv
|
Iterable[Sequence]
|
the data rows from a VIAME-style annotation csv should not include the headers |
required |
Returns:
| Name | Type | Description |
|---|---|---|
viame_csv |
Iterable[Sequence]
|
the data rows in the input only when the annotations are manual, skipping any automated annotations |
Source code in viame2coco/viame_manual_annotations.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
time2micros(time)
convert a datetime.time into total microseconds
>>> time2micros(datetime.time(1,1,1)) # 1 hour, 1 min, 1 sec
3661000000
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
time
|
the time to convert into microseconds |
required |
Returns:
| Name | Type | Description |
|---|---|---|
microseconds |
float | int
|
the total number of microseconds in the time argument |
Source code in viame2coco/viame_manual_annotations.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
viame_is_manual_annotation(viame_csv_row)
returns whether a given row in a VIAME-style annotation output csv represents a manual annotation or an automated annotation.
basically, just checks if the annotation confidence is 1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viame_csv_row
|
Sequence
|
a row read from a VIAME-style annotation csv |
required |
Returns:
| Name | Type | Description |
|---|---|---|
is_manual_annotation |
bool
|
a boolean representing whether this row is manual or not |
Source code in viame2coco/viame_manual_annotations.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |