(im: ndarray, return_seg: bool = False)
| 38 | |
| 39 | |
| 40 | def blob(im: ndarray, return_seg: bool = False) -> ndarray | tuple: |
| 41 | seg = None |
| 42 | if return_seg: |
| 43 | seg = im.astype(np.float32) / 255 |
| 44 | im = im.transpose([2, 0, 1]) |
| 45 | im = im[np.newaxis, ...] |
| 46 | im = np.ascontiguousarray(im).astype(np.float32) / 255 |
| 47 | if return_seg: |
| 48 | return im, seg |
| 49 | else: |
| 50 | return im |
| 51 | |
| 52 | |
| 53 | def sigmoid(x: ndarray) -> ndarray: |
no outgoing calls