Commit 94d1cdda authored by lucasb-eyer's avatar lucasb-eyer
Browse files

Fix import in example and make a little more usable.

parent f5fecadd
#!/usr/bin/python #!/usr/bin/python
""" """
Usage: python dense_inference.py image annotations output
Adapted from the original C++ example: densecrf/examples/dense_inference.cpp Adapted from the original C++ example: densecrf/examples/dense_inference.cpp
http://www.philkr.net/home/densecrf Version 2.2 http://www.philkr.net/home/densecrf Version 2.2
""" """
import numpy as np import numpy as np
import cv2 import cv2
import densecrf as dcrf import pydensecrf.densecrf as dcrf
from skimage.segmentation import relabel_sequential from skimage.segmentation import relabel_sequential
import sys import sys
if len(sys.argv) != 4:
print("Usage: python {} IMAGE ANNO OUTPUT".format(sys.argv[0]))
print("")
print("IMAGE and ANNO are inputs and OUTPUT is where the result should be written.")
sys.exit(1)
img = cv2.imread(sys.argv[1], 1) img = cv2.imread(sys.argv[1], 1)
labels = relabel_sequential(cv2.imread(sys.argv[2], 0))[0].flatten() labels = relabel_sequential(cv2.imread(sys.argv[2], 0))[0].flatten()
output = sys.argv[3] output = sys.argv[3]
......
""" """
Usage: python util_inference_example.py image annotations Adapted from the inference.py to demonstate the usage of the util functions.
Adapted from the dense_inference.py to demonstate the usage of the util
functions.
""" """
import sys import sys
...@@ -15,6 +12,10 @@ from skimage.segmentation import relabel_sequential ...@@ -15,6 +12,10 @@ from skimage.segmentation import relabel_sequential
from pydensecrf.utils import compute_unary, create_pairwise_bilateral, \ from pydensecrf.utils import compute_unary, create_pairwise_bilateral, \
create_pairwise_gaussian create_pairwise_gaussian
if len(sys.argv) != 3:
print("Usage: python {} IMAGE ANNO".format(sys.argv[0]))
sys.exit(1)
fn_im = sys.argv[1] fn_im = sys.argv[1]
fn_anno = sys.argv[2] fn_anno = sys.argv[2]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment