Jump to content
Brian Enos's Forums... Maku mozo!

Machine vision to sort by headstamp


Recommended Posts

So far so good with the servos.  I'm testing the 2 different types and having no issues, if one will outlast the other remains to be seen.  It took a while before the dc motor board burned out.

I have 2 more design tweaks to make to the cad file.  Nothing major, but i think i'll be ready to share the designs from there.

So here's the magic question.  Is anyone interested in helping beta testing this?  You need a 3d printer, minor carpentry skils, a few hundred dollars disposable income, and some linux skills: know how to use ssh, scp, navigate around a bash shell, that sort of stuff.  The Image classification still isn't working to my satisfaction, and now that I changed cameras/lenses I'm retaking all of the images to see if that helps.  If I can get someone else to help by imaging and tagging a bucket of their brass it'll be a big help.


My main focus is still on 9mm.  Once i get a Model that's pretty accurate I plan on switching gears to .223

Link to comment
Share on other sites

  • Replies 136
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)

No linux but have all the rest. If you make a video or document the Linux process I’m game for some beta testing. 

Edited by quiller
Link to comment
Share on other sites

I'm game for some beta testing as well.  


I have a pi 4 and adafruit servo hat already if that helps.  Did you go with the Pi HQ camera?  I was wanting to grab one of those anyway. 

Link to comment
Share on other sites

@assnolaxSend me a PM and we'll discuss tomorrow.  I'm using an Nvidia Jetson now, along with an arducam and a low power microscope lens.  You could make it work with a pi hq cam, you'll just have to tweak the image capture code, shouldn't be too bad.


I'm using the adafruit servo hat so that works too.


I just ran a small sample set and I think i just got image classification up to an honest 85% accuracy.  I only tested on 40 images, but it's looking promising.

Link to comment
Share on other sites

I Have Printers and someone who can help a bit with code and stuff, So I think I might be able to put this thing together and get it working. From there of yourse I can take images and send you everything you need. But be aware that we might use other brands of ammo here in Switzerland. If you let me know what to get hardware wise, I get paid on Tuesday so timing is near perfect :D


Link to comment
Share on other sites

Posted (edited)

I'm done accepting people to beta test for now.


Everyone who messaged me or posted here will get access to the files once I'm ready to share, i'm hoping by next weekend.  I tried to run some .223 through it since i know a lot of you are more interested in rifle brass, and it wasn't as good as i hoped with the last design revision.  Have to make yet another tweak.


@Hansimania send me a PM so I can keep track of you once i'm ready.


My main focus with the little time i had this weekend has been the Image classification, and a bug i was dealing with.  I'm making progress, and now i feel like if i get a lot more training data things should continue to improve and get more accurate.


The current stats are at the bottom of the post in code block text.

Probability threshold means how confident the computer is in the classification being a match to one of the available classes.  If it sees a peice of brass that's brand new.  Say it sees some starline brass and it's never seen that before, it's still going to try to categorize it to the known classes.  Right now my logic send matches over a certain threshold to their buckets if that headstamp has a bucket assigned.  If no bucket is assigned it still goes to the mixed brass bucket.  Anything under that threshold will go to the mixed bucket no matter what.


Example: Let's look at the below block that says 95%.  So what this means is assume i set the probably threshold to 95%, what do my results mean?


  • Correct above 95%: that means 363 pieces of brass, or 75% of the total brass was above the Threshold 95%, and went to the the right output.  IE 'FC' Brass went to the 'FC' bucket, but if it was Tula brass and i had no bucket assigned for Tula brass, it still goes to the mixed bucket.
  • Correct below X: that means  68 pieces or 14% of the total was below the Threshold %, even though the computer guessed right, the probability was too low so it went to the mixed bucket no matter what.  IE the computer guess that FC brass was in fact FC, but wasn't "super confident", so to be cautious it sent it to the mixed brass bucket.
  • InCorrect above X: That means 5 pieces or 1% of the brass went to the wrong bucket.  The computer was "really sure", but it was wrong.   It was "really sure" that a piece of Winchester brass was FC Brass and thus sent it to the FC brass bucket.  It made a mistake.
  • InCorrect below X: 43 peices or 8% of the total: the guess was wrong and the probability was low so it went to the mixed bucket.  So the computer guessed that Winchester was FC, but it wasn't sure, so it went to the mixed brass bucket.  Or maybe it saw a piece of brass it hasn't been trained on, like Starline, and it was only 50% sure so it sent it to the mixed bucket.

One of the incorrect peices of brass was in fact a "new" headstamp, it was PMP, and it was around 96% sure that it was PMC.  and sent it to the PMC bucket.


So in this 95%  example you could say it sorted 76.8% of the brass ran through it with a 1.35% error rate.  Out of 479 pieces of brass, 363 + 5 = 368 pieces were above the Threshold value.  368/479 = 76.8%.  5 out of 368 were wrong,  5/368 = 1.35%.


You will be able to set the threshold to whatever you want.  For example if i set it to 99%, 95%, 90% or 80% here's what i would look like.  As i get more training data my hope is that the results will improve.


Total 479
Correct above 99%: 319 Percent 66 %
Correct below 99%: 112 Percent 23 %
InCorrect above 99%: 1 Percent 0 %
InCorrect below 99%: 47 Percent 9 %



Total 479
Correct above 95%: 363 Percent 75 %
Correct below 95%: 68 Percent 14 %
InCorrect above 95%: 5 Percent 1 %
InCorrect below 95%: 43 Percent 8 %



Total 479
Correct above 90%: 383 Percent 79 %
Correct below 90%: 48 Percent 10 %
InCorrect above 90%: 11 Percent 2 %
InCorrect below 90%: 37 Percent 7 %


Total 479
Correct above 80%: 402 Percent 83 %
Correct below 80%: 29 Percent 6 %
InCorrect above 80%: 18 Percent 3 %
InCorrect below 80%: 30 Percent 6 %


Edited by FingerBlaster
Link to comment
Share on other sites

  • 3 weeks later...

@FingerBlaster. Bless me father for its a few week since we heard from you last!! I'm off the boat Irish Catholic so I can say that! Any update on testing, seems you fell off the radar. Hope all is well. Cheers 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...