Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in 04_skeletonize.py: Function "parse_struc" was compiled in object mode without forceobj=True. #9

Open
Jan-No opened this issue Feb 6, 2020 · 0 comments

Comments

@Jan-No
Copy link

Jan-No commented Feb 6, 2020

Hi,

first of all, thank you for this great project.

I tried to use the 04_skeletonize.py with images that I have created. This is one example image:

prediction8

The make_skeleton() method runs perfectly and produces an excellent ske image as result.

prediction8

However, the graph can't be generated, the output is:

len G.nodes(): 1
len G.edges(): 0

What am I doing wrong?

Thanks in advance for help.

Best,

Jan

PS: My configuration (main method). Values are taken from the sn5_baseline.json:

    log_file = '../results/skeleton.log'
    console, logger1 = make_logger.make_logger(log_file, logger_name='log')

    im_dir = "../data/"
    outfile_csv = "../results/out.csv"
    out_ske_dir = "../results/ske/"
    out_gdir = "../results/gdir/"

    debug = False
    add_small = True
    fix_borders = True
    img_shape = ()  # (1300, 1300)
    skel_replicate = 5
    skel_clip = 2
    img_mult = 255
    hole_size = 300
    cv2_kernel_close = 7
    cv2_kernel_open = 7
    # max_out_size=(16000, 8000)  # works fine
    # max_out_size=(8003, 16009)   # works fine
    max_out_size = (2000000, 2000000)
    spacenet_naming_convention = False

    # from config
    min_subgraph_length_pix = 20
    skeleton_band = 0
    num_classes= 1
    im_prefix = ''
    thresh = 0.3

    t0 = time.time()
    df = build_wkt_dir(im_dir, outfile_csv, out_ske_dir, out_gdir, thresh, #threshes={'2': .3, '3': .3, '4': .3, '5': .2},
                debug=debug, add_small=add_small, fix_borders=fix_borders,
                img_shape=img_shape,
                skel_replicate=skel_replicate, skel_clip=skel_clip,
                img_mult=img_mult, hole_size=hole_size,
                min_subgraph_length_pix=min_subgraph_length_pix,
                cv2_kernel_close=cv2_kernel_close, cv2_kernel_open=cv2_kernel_open,
                max_out_size=max_out_size,
                skeleton_band=skeleton_band,
                num_classes=num_classes,
                im_prefix=im_prefix,
                spacenet_naming_convention=spacenet_naming_convention)

    print ("len df:", len(df))
    print ("outfile:", outfile_csv)
    t1 = time.time()
    logger1.info("Total time to run build_wkt_dir: {} seconds".format(t1-t0))

PPS: The complete output:



 1 / 1 : prediction8.png
  img_loc: ../data/prediction8.png
  im_root: prediction8
  out_ske_file: ../results/ske/prediction8.png
Executing make_skeleton...
log     : INFO     1 / 1 : prediction8.png
make_skeleton(), input img_shape: ()
make_skeleton(), img.shape: (256, 256)
make_skeleton(), img.size: 65536
make_skeleton(), img dtype: uint8
run preprocess()...
Run preprocess() with skimage
Time to run preprocess(): 0.002991199493408203 seconds
skeletonize...
Time to run skimage.skeletonize(): 0.0019943714141845703 seconds
fix_borders...
Time fix borders: 0.0 seconds
ske.shape: (256, 256)
Time to run make_skeleton: 21.24360680580139 seconds
Execute sknw...
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:20: NumbaWarning: 
Compilation is falling back to object mode WITH looplifting enabled because Function "mark" failed type inference due to: Untyped global name 'neighbors': cannot determine Numba type of <class 'function'>

File "utils\sknw.py", line 22:
def mark(img):  # mark the array use (0, 1, 2)
    nbs = neighbors(img.shape)
    ^

  @jit  # my mark
numba.transforms: INFO     finding looplift candidates
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:20: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "mark" failed type inference due to: Untyped global name 'neighbors': cannot determine Numba type of <class 'function'>

File "utils\sknw.py", line 22:
def mark(img):  # mark the array use (0, 1, 2)
    nbs = neighbors(img.shape)
    ^

  @jit  # my mark
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:178: NumbaWarning: Function "mark" was compiled in object mode without forceobj=True, but has lifted loops.

File "utils\sknw.py", line 22:
def mark(img):  # mark the array use (0, 1, 2)
    nbs = neighbors(img.shape)
    ^

  state.func_ir.loc))
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:188: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "utils\sknw.py", line 22:
def mark(img):  # mark the array use (0, 1, 2)
    nbs = neighbors(img.shape)
    ^

  state.func_ir.loc))
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:92: NumbaWarning: 
Compilation is falling back to object mode WITH looplifting enabled because Function "parse_struc" failed type inference due to: Untyped global name 'neighbors': cannot determine Numba type of <class 'function'>

File "utils\sknw.py", line 94:
def parse_struc(img):
    nbs = neighbors(img.shape)
    ^

  @jit  # parse the image then get the nodes and edges
numba.transforms: INFO     finding looplift candidates
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:92: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "parse_struc" failed type inference due to: Untyped global name 'neighbors': cannot determine Numba type of <class 'function'>

File "utils\sknw.py", line 94:
def parse_struc(img):
    nbs = neighbors(img.shape)
    ^

  @jit  # parse the image then get the nodes and edges
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:178: NumbaWarning: Function "parse_struc" was compiled in object mode without forceobj=True, but has lifted loops.

File "utils\sknw.py", line 94:
def parse_struc(img):
    nbs = neighbors(img.shape)
    ^

  state.func_ir.loc))
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:188: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "utils\sknw.py", line 94:
def parse_struc(img):
    nbs = neighbors(img.shape)
    ^

  state.func_ir.loc))
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:92: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "parse_struc" failed type inference due to: non-precise type pyobject
[1] During: typing of argument at C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py (101)

File "utils\sknw.py", line 101:
def parse_struc(img):
    <source elided>
    nodes = []
    for p in pts:
    ^

  @jit  # parse the image then get the nodes and edges
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:178: NumbaWarning: Function "parse_struc" was compiled in object mode without forceobj=True.

File "utils\sknw.py", line 101:
def parse_struc(img):
    <source elided>
    nodes = []
    for p in pts:
    ^

  state.func_ir.loc))
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:188: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "utils\sknw.py", line 101:
def parse_struc(img):
    <source elided>
    nodes = []
    for p in pts:
    ^

  state.func_ir.loc))
C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py:92: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "parse_struc" failed type inference due to: non-precise type pyobject
[1] During: typing of argument at C:\Users\Jan.noessner\Documents\01_road_detection\resources\centerline\cresi\cresi\utils\sknw.py (108)

File "utils\sknw.py", line 108:
def parse_struc(img):
    <source elided>
    edges = []
    for p in pts:
    ^

  @jit  # parse the image then get the nodes and edges
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:178: NumbaWarning: Function "parse_struc" was compiled in object mode without forceobj=True.

File "utils\sknw.py", line 108:
def parse_struc(img):
    <source elided>
    edges = []
    for p in pts:
    ^

  state.func_ir.loc))
C:\Apps\Anaconda3\envs\ml\lib\site-packages\numba\object_mode_passes.py:188: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "utils\sknw.py", line 108:
def parse_struc(img):
    <source elided>
    edges = []
    for p in pts:
    ^

  state.func_ir.loc))
log     : INFO     Time to build graph: 1018.8935737609863 seconds
log     : INFO     Total time to run build_wkt_dir: 1018.8965332508087 seconds
len G.nodes(): 1
len G.edges(): 0
len df: 1
outfile: ../results/out.csv

Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant