We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Thank a lot in advance.
i use -json_port to send the data to website http://localhost:8070 But now i want to transfer the data to my ROS system. i have some problem for this
#!/usr/bin/python2 import urllib import json import ssl import json import rospy from std_msgs.msg import ColorRGBA ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE frame_now = 0 #website location serviceurl = 'http://127.0.0.1:8070' pub1 = rospy.Publisher('data_from_yolov3' , ColorRGBA , queue_size = 10) def talker(): rospy.init_node('get_data_yolo',anonymous = True) rate = rospy.Rate(10) while not rospy.is_shutdown(): url = serviceurl print('Retrieving', url) uh = urllib.urlopen(url) data = uh.read().decode() print('Retrieved') try: js = json.loads(data) get_data(js) except: js = None if not js or 'status' not in js or js['status'] != 'OK': print('==== Failure To Retrieve ====') print(data) #functtion def get_data(distros_dict): json_to_variable = [] global frame_id, class_id,x,y,width,height # For every frame. for distro in distros_dict: filename = distro['filename'] if len(distro['objects']) != 0: # For every detection. for obj in range(len(distro['objects'])): # Get values. frame_id = distro['frame_id'] frame_now = frame_now + 1 class_id = distro['objects'][obj]["class_id"] x = distro['objects'][obj]["relative_coordinates"]["center_x"] y = distro['objects'][obj]["relative_coordinates"]["center_y"] width = distro['objects'][obj]["relative_coordinates"]["width"] height = distro['objects'][obj]["relative_coordinates"]["height"] confidence = distro['objects'][obj]["confidence"] # width640 x = x*1280 # height480 y = y*720 # detect_image real height and width width = width * 1280 height = height * 720 # deal with the data # And print them. ####################### # publish data pub1.publish(x,y,width,height) ####################### print(frame_id, class_id, x, y, width, height, confidence) if __name__ == '__main__' : try: talker() except rospy.ROSInterruptException: pass #over
terminal line Retrieving from 'http://127.0.0.1:8070'
so it cannot open the url. if anyone can teach me how to solve the problem.
The text was updated successfully, but these errors were encountered:
If you want to use ROS with YOLO, try these repositories / pull requests:
Sorry, something went wrong.
Thank for your help , i will try this way.
No branches or pull requests
Thank a lot in advance.
i use -json_port to send the data to website http://localhost:8070
But now i want to transfer the data to my ROS system.
i have some problem for this
terminal line
Retrieving from 'http://127.0.0.1:8070'
so it cannot open the url.
if anyone can teach me how to solve the problem.
The text was updated successfully, but these errors were encountered: