Git Product home page Git Product logo

Comments (5)

knorth55 avatar knorth55 commented on May 28, 2024 1

you can add the fps counter on the visualization image,
but we have rostopic hz, so it seems not exciting to me.
If you want to write the fps counter on visualization image, please change code below.

def visualize_cb(self, event):
if (not self.visualize or self.img is None or self.encoding is None
or self.header is None or self.bboxes is None
or self.labels is None or self.scores is None):
return
with self.lock:
vis_img = self.img.copy()
encoding = copy.copy(self.encoding)
header = copy.deepcopy(self.header)
bboxes = self.bboxes.copy()
labels = self.labels.copy()
scores = self.scores.copy()
# bbox
cmap = matplotlib.cm.get_cmap('hsv')
n = max(len(bboxes) - 1, 10)
for i, (bbox, label, score) in enumerate(zip(bboxes, labels, scores)):
rgba = np.array(cmap(1. * i / n))
color = rgba[:3] * 255
label_text = '{}, {:.2f}'.format(self.label_names[label], score)
p1y = max(bbox[0], 0)
p1x = max(bbox[1], 0)
p2y = min(bbox[2], vis_img.shape[0])
p2x = min(bbox[3], vis_img.shape[1])
cv2.rectangle(
vis_img, (p1x, p1y), (p2x, p2y),
color, thickness=3, lineType=cv2.LINE_AA)
cv2.putText(
vis_img, label_text, (p1x, max(p1y - 10, 0)),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, color,
thickness=2, lineType=cv2.LINE_AA)
if self.pub_image.get_num_connections() > 0:
vis_msg = self.bridge.cv2_to_imgmsg(vis_img, 'rgb8')
# BUG: https://answers.ros.org/question/316362/sensor_msgsimage-generates-float-instead-of-int-with-python3/ # NOQA
vis_msg.step = int(vis_msg.step)
vis_msg.header = header
self.pub_image.publish(vis_msg)
if self.pub_image_compressed.get_num_connections() > 0:
# publish compressed http://wiki.ros.org/rospy_tutorials/Tutorials/WritingImagePublisherSubscriber # NOQA
vis_compressed_msg = CompressedImage()
vis_compressed_msg.header = header
# image format https://github.com/ros-perception/image_transport_plugins/blob/f0afd122ed9a66ff3362dc7937e6d465e3c3ccf7/compressed_image_transport/src/compressed_publisher.cpp#L116 # NOQA
vis_compressed_msg.format = encoding + '; jpeg compressed bgr8'
vis_img_rgb = cv2.cvtColor(vis_img, cv2.COLOR_BGR2RGB)
vis_compressed_msg.data = np.array(
cv2.imencode('.jpg', vis_img_rgb)[1]).tostring()
self.pub_image_compressed.publish(vis_compressed_msg)

from coral_usb_ros.

knorth55 avatar knorth55 commented on May 28, 2024 1

score_thresh can be changed from dynamic reconfigure.

https://github.com/jsk-ros-pkg/coral_usb_ros/blob/master/python/coral_usb/detector_base.py#L57-L66
https://github.com/jsk-ros-pkg/coral_usb_ros/blob/master/cfg/EdgeTPUObjectDetector.cfg#L9

from coral_usb_ros.

Petros626 avatar Petros626 commented on May 28, 2024

yes I didn't think about the rostopic hz will pay attention to that.
Okay so in detector_base.py everything personal could be add, thats I'm searching for :)

I don't found in launch file or in this script the threshold for proposing the bounding boxes for example IoU > 0.5.

from coral_usb_ros.

knorth55 avatar knorth55 commented on May 28, 2024

we don't have iou_thresh. we have score_thresh.

from coral_usb_ros.

Petros626 avatar Petros626 commented on May 28, 2024

yes right, where i can config it? to change the score_thresh?

from coral_usb_ros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.