File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/python
22
33"""
4- Usage: python dense_inference.py image annotations output
5-
64Adapted from the original C++ example: densecrf/examples/dense_inference.cpp
75http://www.philkr.net/home/densecrf Version 2.2
86"""
97
108import numpy as np
119import cv2
12- import densecrf as dcrf
10+ import pydensecrf . densecrf as dcrf
1311from skimage .segmentation import relabel_sequential
1412import sys
1513
14+ if len (sys .argv ) != 4 :
15+ print ("Usage: python {} IMAGE ANNO OUTPUT" .format (sys .argv [0 ]))
16+ print ("" )
17+ print ("IMAGE and ANNO are inputs and OUTPUT is where the result should be written." )
18+ sys .exit (1 )
19+
1620img = cv2 .imread (sys .argv [1 ], 1 )
1721labels = relabel_sequential (cv2 .imread (sys .argv [2 ], 0 ))[0 ].flatten ()
1822output = sys .argv [3 ]
Original file line number Diff line number Diff line change 11"""
2- Usage: python util_inference_example.py image annotations
3-
4- Adapted from the dense_inference.py to demonstate the usage of the util
5- functions.
2+ Adapted from the inference.py to demonstate the usage of the util functions.
63"""
74
85import sys
1512from pydensecrf .utils import compute_unary , create_pairwise_bilateral , \
1613 create_pairwise_gaussian
1714
15+ if len (sys .argv ) != 3 :
16+ print ("Usage: python {} IMAGE ANNO" .format (sys .argv [0 ]))
17+ sys .exit (1 )
18+
1819fn_im = sys .argv [1 ]
1920fn_anno = sys .argv [2 ]
2021
You can’t perform that action at this time.
0 commit comments