Kitware / kwiver

Pulls Together Computer Vision Algorithms into Highly-Modular Run-Time Configurable Systems
Other
190 stars 83 forks source link

"_scheduler:type = pythread_per_process" required to use Python arrows with Python 3.7 #949

Open predicative opened 4 years ago

predicative commented 4 years ago

The simple pipeline file at the end of this post (adapted from example_pydetector_on_image.pipe; image_list.txt is the file in that folder) runs to completion with Python 3.6, but not Python 3.7, where it blocks and must be killed. However, if the block

config _scheduler
  type = pythread_per_process

is added to the file, it runs to completion on Python 3.7. Adding some logging to simple_image_detector.py shows that a SimpleImageDetector is initialized (__init__) and configured (set_configuration), but its detect method is never called. Changing to 3.6 or adding the above block shows detect being called the appropriate number of times.

The pybind11 version is 2.2.1 from Fletch (which is nearly 2.5 years old! The current version is 2.4.3 from October). GCC is version 9.2.1. Let me know if any other version information is relevant.

@as6520, @Erotemic, do you know who's familiar with the (Python) scheduler and interpreter embedding?


example.pipe:

# ================================================================
process input
  :: frame_list_input
  image_list_file   = image_list.txt
  frame_time        = .3333
  image_reader:type = ocv

# ================================================================
process detector
  :: image_object_detector
  detector:type                         = SimpleImageObjectDetector
  detector:example_detector:center_x    = 200
  detector:example_detector:center_y    = 200
  detector:example_detector:width       = 200
  detector:example_detector:height      = 100

# ================================================================
process draw
  :: draw_detected_object_set
  draw_algo:type = ocv
  draw_algo:ocv:default_line_thickness = 3

# ================================================================
# global pipeline config
#
config _pipeline:_edge
       capacity = 2

# ================================================================
# connections
connect from input.image
        to   detector.image

connect from detector.detected_object_set
        to   draw.detected_object_set
connect from input.image
        to draw.image

# -- end of file --
Erotemic commented 4 years ago

@KyleFromKitware might know something about the interpreter embedding.

linus-sherrill commented 4 years ago

AFIK, the scheduler config block was always required for Python 2.x I don't know if this helps or not.

mattdawkins commented 2 years ago

I attempted to use Python 3.8 and 3.10, and both required the python scheduler, unlike Python3.6 where the C++ or python scheduler work.

I also attempted a pybind11 upgrade which had no affect on behavior