-
Notifications
You must be signed in to change notification settings - Fork 7
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
Test Tub Detection (Assuming circular shape) #2
base: master
Are you sure you want to change the base?
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.
This is just a test. Please add the rest of your code!
… - needs improvement in accuracy
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 pretty good! I thought the self.dist = lambda
stuff was really cool (I'm stealing that). Listed some comments for you two iterate on! :)
|
||
|
||
import cv2 as cv |
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.
Add these imports to the top of the file since that's where all of them are. Just good python coding procedure
self.debug = False | ||
|
||
def predict(self, frame): |
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.
Using python typing, you can say the following:
def predict(self, frame) -> List[Tuple[[int, int]]]:
This increases code readability so a person looking at this can more easily tell what this function takes in for input and output. You may need to import Tuple and List from typing
return pred | ||
|
||
def getCircles(self): |
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.
Same thing but you can do def getCircles(self) -> None
|
||
from xarm.wrapper import XArmAPI | ||
from gizzmos import CustomGripper, PressureSensor | ||
from pcr.gizzmos import CustomGripper, PressureSensor, AtalantaModule |
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.
You should probably add TestTubeCV instead of AtalantaModule
Returns: None | ||
""" | ||
while True: |
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.
Can you setup the code such as the if someone calls predict, we can just open the vidoecapture briefly (like one frame) and feed it in. Currently, this code will run forever without letting any of the xArm code to run
circles = np.uint16(np.around(circles)) | ||
chosen = None | ||
for i in circles[0, :]: |
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.
Could you explain in comments what's happening here? I think you're comparing the Eucledian distance between chosen and i but not sure what that means or what the algorithm here is...
if cv.waitKey(1) == ord('q'): | ||
break | ||
self.videoCapture.release() |
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.
Yeah, I don't think we need this getCircles() method tbh since it'll just be a one off call not a continuous call. I'd just use that for the predict() method. Look at the above comment for more information.
Description
This will take in an image feed, read and preprocess a single frame, and generate predictions of possible circular test tube openings via a Hough transform.
Working Hough Transform has notoriously low accuracy, can't detect plastic tube entrances unless there is a lot of contrast around the border
I suspect overfitting may be at play here since it's extremely conservative in its predictions.
Attempted RANSAC for better circle detection - didn't work as well as Hough Transform
Attempted to combine the two, but the resultant model did not yield a better result than just using a Hough Transform.
Utilizing a Neural Net-based architecture to identify test tubes via bounding boxes. Maybe YOLOv5 or some other conventional model.
Testing
WIP
WIP