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

Road signs classifier #436

Merged
merged 32 commits into from
Nov 13, 2024
Merged

Road signs classifier #436

merged 32 commits into from
Nov 13, 2024

Conversation

pranavboyapati
Copy link

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.

Copy link

@akevinge akevinge left a 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.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
src/perception/road_signs_classifier/test/test_flake8.py Outdated Show resolved Hide resolved
src/perception/road_signs_classifier/test/test_pep257.py Outdated Show resolved Hide resolved
Comment on lines 39 to 47
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:

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?

Copy link
Author

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

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')

Copy link
Author

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

Copy link

@akevinge akevinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akevinge akevinge merged commit e111f46 into dev Nov 13, 2024
1 check passed
@pranavboyapati pranavboyapati deleted the perception/road_signs_classifier branch November 13, 2024 04:18
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

Successfully merging this pull request may close these issues.

3 participants