ros_bridge boost error

I am trying to create a ROS wrapper for caffe2 (Ros Kinetic, opencv version-3.4.1) and I get the following error:

[ERROR] [1532132328.463265]: bad callback: <bound method image_converter.callback of <main.image_converter instance at 0x7f01bdc8e7a0>>
Traceback (most recent call last):
File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py”, line 750, in _invoke_callback
cb(msg)
File “ros_mercnn.py”, line 72, in callback
cv_image = self.bridge.imgmsg_to_cv2(data, ‘bgr8’)
File “/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py”, line 182, in imgmsg_to_cv2
res = cvtColor2(im, img_msg.encoding, desired_encoding)
ArgumentError: Python argument types in
cv_bridge.boost.cv_bridge_boost.cvtColor2(numpy.ndarray, str, unicode)
did not match C++ signature:
cvtColor2(boost::python::api::object, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)

Any help will be highly appreciated

#!/usr/bin/env python

"""Perform inference on a single image or all images with a certain  extension

(e.g., .jpg) in a folder.
“”"

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from collections import defaultdict
import argparse
import cv2  # NOQA (Must import before importing caffe2 due to bug in cv2)
import glob
import logging
import os
import sys
import time

from caffe2.python import workspace

import roslib
#roslib.load_manifest('my_package')
import sys
import rospy
#import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class image_converter:	

    def __init__(self):

	    self.bridge = CvBridge()
	    self.image_sub = rospy.Subscriber("/usb_cam/image_raw",Image,self.callback)
	    cv2.waitKey(1000000)
    def callback(self, data):
	    currentframe = 0
	    try:
		    while True:

		    	cv_image = self.bridge.imgmsg_to_cv2(data, 'bgr8')

			
	    except CvBridgeError as e:	
		    print(e)
def main(args):
    ic = image_converter()
    rospy.init_node('image_converter', anonymous=True)
    try:
	    cv2.waitKey(1000)
	    rospy.spin()
    except KeyboardInterrupt:
	    print('Shutting Down')
    cv2.destroyAllWindows()

if __name__ == '__main__':

        workspace.GlobalInit(['caffe2', '--caffe2_log_level=0'])
 #      setup_logging(__name__)
    main(sys.argv)

Thanks for your question. However we ask that you please ask questions on http://answers.ros.org following our support guidelines: http://wiki.ros.org/Support

ROS Discourse is for news and general interest discussions. ROS Answers provides a forum which can be filtered by tags to make sure the relevant people can find and/or answer the question, and not overload everyone with hundreds of posts.

If you’d like you can reply with a link to your answers.ros.org question, but in the future please start there.