Skip to content

Commit 94d1cdd

Browse files
committed
Fix import in example and make a little more usable.
1 parent f5fecad commit 94d1cdd

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

examples/inference.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
#!/usr/bin/python
22

33
"""
4-
Usage: python dense_inference.py image annotations output
5-
64
Adapted from the original C++ example: densecrf/examples/dense_inference.cpp
75
http://www.philkr.net/home/densecrf Version 2.2
86
"""
97

108
import numpy as np
119
import cv2
12-
import densecrf as dcrf
10+
import pydensecrf.densecrf as dcrf
1311
from skimage.segmentation import relabel_sequential
1412
import 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+
1620
img = cv2.imread(sys.argv[1], 1)
1721
labels = relabel_sequential(cv2.imread(sys.argv[2], 0))[0].flatten()
1822
output = sys.argv[3]

examples/utils_example.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
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

85
import sys
@@ -15,6 +12,10 @@
1512
from 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+
1819
fn_im = sys.argv[1]
1920
fn_anno = sys.argv[2]
2021

0 commit comments

Comments
 (0)