-
Notifications
You must be signed in to change notification settings - Fork 11
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
Road signs classifier #436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just requested documentation / another pass at the code.
src/perception/road_signs_classifier/road_signs_classifier/road_signs_classifier.py
Outdated
Show resolved
Hide resolved
cv2.imwrite("image.jpeg", cv_image) | ||
self.classify_sign() | ||
|
||
|
||
#main control function | ||
def classify_sign(self): | ||
#gets prediction | ||
if (os.path.exists("image.jpeg")): | ||
with open("image.jpeg", "rb") as img_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why we write the image to disk and read it back instead of just passing it as a parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was causing all sorts of errors when I tried to pass the image as a parameter, but those all disappeared when writing to disk and reading it back, so figured that was the best way to go about doing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried something like:
_, jpeg_image = cv2.imencode('.jpg', cv_image)
base64.b64encode(jpeg_image).decode('utf-8')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried that and it works. Previously when I tried cv2.imencode
, I did not do b64encode
because the articles I had read said it is unnecessary in that case, but putting it in now made it work. I guess those articles were wrong
src/perception/road_signs_classifier/road_signs_classifier/road_signs_classifier.py
Outdated
Show resolved
Hide resolved
src/perception/road_signs_classifier/road_signs_classifier/road_signs_classifier.py
Show resolved
Hide resolved
src/perception/road_signs_classifier/road_signs_classifier/road_signs_classifier.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Completed the road signs classifier. Takes in camera images and publishes road sign detection information over the topic /road_signs/detections. To use this in other nodes, must use the classification type and also the ratio of height to width in order to know the sign type. This has been tested on multiple ros bags and works as expected.