(size, box)
| 1596 | |
| 1597 | # parse XML annotations |
| 1598 | def convert(size, box): |
| 1599 | dw = 1. / size[0] |
| 1600 | dh = 1. / size[1] |
| 1601 | x = (box[0] + box[1]) / 2.0 |
| 1602 | y = (box[2] + box[3]) / 2.0 |
| 1603 | w = box[1] - box[0] |
| 1604 | h = box[3] - box[2] |
| 1605 | x = x * dw |
| 1606 | w = w * dw |
| 1607 | y = y * dh |
| 1608 | h = h * dh |
| 1609 | return x, y, w, h |
| 1610 | |
| 1611 | def convert_annotation(file_name): |
| 1612 | """Given VOC2012 XML Annotations, returns number of objects and info.""" |
no outgoing calls
no test coverage detected
searching dependent graphs…