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

Problem with my own detector.py #43

Open
xMutzelx opened this issue Jul 12, 2016 · 0 comments
Open

Problem with my own detector.py #43

xMutzelx opened this issue Jul 12, 2016 · 0 comments

Comments

@xMutzelx
Copy link

xMutzelx commented Jul 12, 2016

Hi community,
I write my own post processing pipeline but I get some ecto/ork errors. At this point I simply try to read my training-file from the database.

The error when I try to run my detection pipeline:

Traceback (most recent call last):
  File "/home/marcel/catkin_ws/src/object_recognition_core/apps/detection", line 24, in <module>
    run_plasm(args, plasm)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/ecto/opts.py", line 85, in run_plasm
    sched.execute(options.niter)
ecto.CellException:            exception_type  CellException
[cell_name] = pipeline1

[cell_type] = ecto::py::BlackBox

[function_name] = process_with_only_these_inputs

[type] = std::runtime_error

[what] =            exception_type  CellException
[cell_name] = <class 'object_recognition_colorhist.colorhist_detection.ModelReader'>

[type] = boost::exception_detail::clone_impl<ecto::except::FailedFromPythonConversion>

[what] = FailedFromPythonConversion

[when] = Copying out to object_id

My Trainer is working fine and it is also reading/writing some files from the database. I think the error is in my detection.py script.
This is my detection.py script:

from ecto import BlackBoxCellInfo as CellInfo, BlackBoxForward as Forward
from object_recognition_core.db import Document, Documents
from ecto_opencv import calib, features2d, highgui
from ecto_opencv.features2d import FeatureDescriptor
from object_recognition_core.pipelines.detection import DetectorBase
from object_recognition_colorhist import colorhist_detection
import ecto
from ecto import BlackBoxCellInfo as CellInfo, BlackBoxForward as Forward

class ColorHistDetector(ecto.BlackBox, DetectorBase):
    def __init__(self, *args, **kwargs):
        print "test0"
        ecto.BlackBox.__init__(self, *args, **kwargs)
        DetectorBase.__init__(self)

    @staticmethod
    def declare_cells(p):

        cells = {'json_db': CellInfo(ecto.Constant),
                 'object_id': CellInfo(ecto.Constant),
                 'model_reader': CellInfo(colorhist_detection.ModelReader),
                 'detector' : CellInfo(colorhist_detection.Detector)} 
        return cells

    @classmethod
    def declare_forwards(cls, _p):
        p = {'json_db': [Forward('value', 'json_db')],
             'object_id': [Forward('value', 'object_id')]}
        i = {}
        o = {'detector': [Forward('pose_results')]}

        return (p,i,o)

    @classmethod
    def declare_direct_params(self, p):
        p.declare('json_object_ids', 'The ids of the objects to find as a JSON list or the keyword "all".', 'all')

    def connections(self, p):
        connections = [ self.json_db[:] >> self.model_reader['json_db'],
        self.object_id[:] >> self.model_reader['object_id'] ]
       # connections += [ self.model_reader['colorValues'] >> self.detector['colorValues'] ]

        return connections

My very simple detection.ros.ork configuration file:

# info about the db
pipeline1:
  type: ColorHistDetector
  module: object_recognition_colorhist
  parameters:
    object_ids: "all"
    db:
      type: 'CouchDB'
      root: 'http://localhost:5984'
      collection: 'object_recognition'

In my understanding 'object_id': [Forward('value', 'object_id')] contains no valid data but I might be wrong.
I am working with Ubuntu 14.04 and Ros Indigo.
Thank you very much.

@xMutzelx xMutzelx changed the title Problem with detector.py Problem with my own detector.py Jul 12, 2016
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