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

Machine vision to sort by headstamp


Recommended Posts

  • Replies 236
  • Created
  • Last Reply

Top Posters In This Topic

Quote

For speed, this is a bigger deal. You could probably do this reasonably quickly (I'm saying 2-3 pieces of brass a second)

 

If it keeps someone from having to do it, I don’t see that as much of a issue.  If it’s fed by a collator so you can turn it on and do something else, it wouldn’t be a problem if it were only one a second.

Link to comment
Share on other sites

StandardError, if you missed my early comment on the "sortinator" machine which already does this but sells for $3k, there are a few details at this link:

https://www.hasgrok.com/?product=sortinator-1000

The first videos lean toward mechanics - which I believe several here (especially jmorris) could easily improve on, and the last 2 videos have information you might find interesting about their software.  Best of luck and I hope to share and contibute in this experience.

Link to comment
Share on other sites

Maybe something like this could be used with Raspberry Pi to get more power into image recognition?
https://software.intel.com/en-us/movidius-ncs

https://software.intel.com/en-us/neural-compute-stick


I've been thinking of a simple solution with Dillon casefeeder, raspberry with a servo motor and simple 3D-printable parts. Would do sorting into two piles: the brass we want and the rest. If that would be done fast enough, it wouldn't matter if multiple passes would be required...

Edited by mikamarj
Link to comment
Share on other sites

  • 4 months later...
On 2/26/2019 at 6:07 PM, jmorris said:

 

Figure out the computation part and I’ll knock out the physical part.

 

I did get a little further on my sort by weight project but it’s still not much more than proof of concept at this point.

 

https://www.youtube.com/watch?v=1V_Hm3oqlO4

 

I actually registered just to respond to this post. I'm a software engineer with experience in backend web development (mostly Python, including Django, Flask, etc.), embedded software, Linux, and more recently, machine vision. I wrote and trained an ML model last year to sort 5.56 brass by headstamp, and it does so with 100% accuracy based on my validation data.

 

Here are some samples that were all correctly classified. https://imgur.com/a/90eSE

 

The code is open source, and freely available here: https://github.com/jakogut/brass-sorter

 

It was actually rather easy, and it's quite quick, even on an RPi 3 (even faster on many other inexpensive SBCs out there). If memory serves, it takes about a tenth of a second to classify each piece of brass, but don't quote me on that.

 

I haven't spent much time or effort on the mechanical side of this, because it's not my strong suite, but if somebody could build a machine that could be controlled by an RPi, I could write all the software to make it happen. It would be really neat if the parts could be 3D printed, and the machine could be built for a couple hundred bucks. I'm also very experienced with (and an active contributor to) Buildroot, and I could make a set of scripts to build a firmware image automatically that would be easy for DIYers to install.

 

I'd be willing to do this work and open source it, if some of you want to work on the hardware side of things.

Link to comment
Share on other sites

3 minutes ago, jakogut said:

 

I actually registered just to respond to this post. I'm a software engineer with experience in backend web development (mostly Python, including Django, Flask, etc.), embedded software, Linux, and more recently, machine vision. I wrote and trained an ML model last year to sort 5.56 brass by headstamp, and it does so with 100% accuracy based on my validation data.

 

Here are some samples that were all correctly classified. https://imgur.com/a/90eSE

 

The code is open source, and freely available here: https://github.com/jakogut/brass-sorter

 

It was actually rather easy, and it's quite quick, even on an RPi 3 (even faster on many other inexpensive SBCs out there). If memory serves, it takes about a tenth of a second to classify each piece of brass, but don't quote me on that.

 

I haven't spent much time or effort on the mechanical side of this, because it's not my strong suite, but if somebody could build a machine that could be controlled by an RPi, I could write all the software to make it happen. It would be really neat if the parts could be 3D printed, and the machine could be built for a couple hundred bucks. I'm also very experienced with (and an active contributor to) Buildroot, and I could make a set of scripts to build a firmware image automatically that would be easy for DIYers to install.

 

I'd be willing to do this work and open source it, if some of you want to work on the hardware side of things.

 

 

This is pretty neat and probably what I would have done. I'm going to assume that the .hdf5 is the model weights?

 

If I can ask, what was the ROC-AUC for your model? Don't get me wrong. It's very impressive, but I had been debating about how much any model's robustness would be impacted by the quality of imaging and such.

 

Also, getting it on an RPi3 is pretty nice. I was tempted to use one of the intel compute chips but suspected that'd be overkill :P

 

I've just been sidelined with thesis revisions and haven't been able to really go at it but this is pretty cool.

 

 

Link to comment
Share on other sites

2 hours ago, jakogut said:

 

I actually registered just to respond to this post. I'm a software engineer with experience in backend web development (mostly Python, including Django, Flask, etc.), embedded software, Linux, and more recently, machine vision. I wrote and trained an ML model last year to sort 5.56 brass by headstamp, and it does so with 100% accuracy based on my validation data.

 

Here are some samples that were all correctly classified. https://imgur.com/a/90eSE

 

The code is open source, and freely available here: https://github.com/jakogut/brass-sorter

 

It was actually rather easy, and it's quite quick, even on an RPi 3 (even faster on many other inexpensive SBCs out there). If memory serves, it takes about a tenth of a second to classify each piece of brass, but don't quote me on that.

 

I haven't spent much time or effort on the mechanical side of this, because it's not my strong suite, but if somebody could build a machine that could be controlled by an RPi, I could write all the software to make it happen. It would be really neat if the parts could be 3D printed, and the machine could be built for a couple hundred bucks. I'm also very experienced with (and an active contributor to) Buildroot, and I could make a set of scripts to build a firmware image automatically that would be easy for DIYers to install.

 

I'd be willing to do this work and open source it, if some of you want to work on the hardware side of things.

 

This is very cool, and I'd be willing to contribute on the hardware side. I don't have the free time right now to commit to building a complete system, but I can help out with machining on various parts and some design input. 

 

One thought & question on the software side - could this be used to separate between crimped and uncrimped or processed brass? I'm guessing so, it would just need to look at the primer pocket crimp instead of (or along with?) the headstamp. I'd love to have an easy way to sort out crimped primer pocket 9mm brass; that stuff has been a plague on my reloading process lately.

Link to comment
Share on other sites

3 hours ago, StandardError said:

 

 

This is pretty neat and probably what I would have done. I'm going to assume that the .hdf5 is the model weights?

 

If I can ask, what was the ROC-AUC for your model? Don't get me wrong. It's very impressive, but I had been debating about how much any model's robustness would be impacted by the quality of imaging and such.

 

Also, getting it on an RPi3 is pretty nice. I was tempted to use one of the intel compute chips but suspected that'd be overkill :P

 

I've just been sidelined with thesis revisions and haven't been able to really go at it but this is pretty cool.

 

 

 

Correct, the hdf5 file is where the model weights are stored.

 

Check out the images I posted and the results. In my opinion, the model is more accurate with low quality images than a person would be.

 

For training, you certainly want a little more horsepower than an RPi, but for classification, it's plenty fast enough. The model is small, and the classification time is quicker than a brass feeder.

 

37 minutes ago, Yondering said:

 

This is very cool, and I'd be willing to contribute on the hardware side. I don't have the free time right now to commit to building a complete system, but I can help out with machining on various parts and some design input. 

 

One thought & question on the software side - could this be used to separate between crimped and uncrimped or processed brass? I'm guessing so, it would just need to look at the primer pocket crimp instead of (or along with?) the headstamp. I'd love to have an easy way to sort out crimped primer pocket 9mm brass; that stuff has been a plague on my reloading process lately.

 

You absolutely could separate based on crimped primer pockets. You can basically sort by any criteria that a person would be able to visually recognize, assuming the fidelity of the image is good enough. Processed brass may be more difficult, because there's not a very obvious visual indicator that it's already been processed.

Edited by jakogut
Link to comment
Share on other sites

On 7/9/2019 at 7:13 PM, jakogut said:

 

Correct, the hdf5 file is where the model weights are stored.

 

Check out the images I posted and the results. In my opinion, the model is more accurate with low quality images than a person would be.

 

For training, you certainly want a little more horsepower than an RPi, but for classification, it's plenty fast enough. The model is small, and the classification time is quicker than a brass feeder.

 

 

You absolutely could separate based on crimped primer pockets. You can basically sort by any criteria that a person would be able to visually recognize, assuming the fidelity of the image is good enough. Processed brass may be more difficult, because there's not a very obvious visual indicator that it's already been processed.

 

 

I did have a look at the images both in your post and the git repo. And the results are quite good.

 

What I was wondering was whether you could refine it to make it a multinomial classifier as opposed to just LC vs non-LC. It's just that it would require significantly more training data and labeling, too.

 

Tbh, you could just as easily run this in a cloud setup so you don't need to recompile client-side every time the model is retrained. And an AWS micro instance probably has enough horsepower to do it (run the forward model).

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...
On 7/9/2019 at 2:54 PM, jakogut said:

 

I actually registered just to respond to this post. I'm a software engineer with experience in backend web development (mostly Python, including Django, Flask, etc.), embedded software, Linux, and more recently, machine vision. I wrote and trained an ML model last year to sort 5.56 brass by headstamp, and it does so with 100% accuracy based on my validation data.

 

Here are some samples that were all correctly classified. https://imgur.com/a/90eSE

 

The code is open source, and freely available here: https://github.com/jakogut/brass-sorter

 

It was actually rather easy, and it's quite quick, even on an RPi 3 (even faster on many other inexpensive SBCs out there). If memory serves, it takes about a tenth of a second to classify each piece of brass, but don't quote me on that.

 

I haven't spent much time or effort on the mechanical side of this, because it's not my strong suite, but if somebody could build a machine that could be controlled by an RPi, I could write all the software to make it happen. It would be really neat if the parts could be 3D printed, and the machine could be built for a couple hundred bucks. I'm also very experienced with (and an active contributor to) Buildroot, and I could make a set of scripts to build a firmware image automatically that would be easy for DIYers to install.

 

I'd be willing to do this work and open source it, if some of you want to work on the hardware side of things.

 

 

I sent you a PM.

Link to comment
Share on other sites

  • 8 months later...
  • 6 months later...

I am interested in building one of these. A smaller home version, not a high speed commercial version.

So far I have 3D printed a case feeder https://www.youtube.com/watch?v=ZpMwxtec5aw I just built the top portion and ignored the bottom portion. This worked great for about 5 minutes, when it jammed and broke the geared motor. My next step was to create a motor controller using an arduino. I followed this advice to sense a jam and then reversed the motor https://electronics.stackexchange.com/questions/300768/how-to-tell-a-dc-motor-is-stuck . Right now this is being used with a Lee App Press to deprime, size and flare my cases. This is working very well right now. 

A couple of notes on the case feeder mentioned above. While it is great, I found a few issues that I would like to change. The slot in the bucket is made for 9MM and not big enough for 45 ACP so I manually enlarged using a file. The shute from the bucket was made large enough to accommodate larger cases but I find that 9MM can jam since they can end up sideways as they bounce down the shute, so working on a solution for this. I also changed the motor to one from Amazon that was less expensive, so I had to modify the frame to accommodate it. 

However I want to change the bottom end to a head stamp sorter. I plan on mainly using a 3D printer since I don't have a lathe or mill. I have played around with machine learning and think this would be a good practical project. 

I work full time so this won't be done in days or weeks but hopefully within the next year. 

I will set up a github site with the project including my motor control system.

Right now, I am designing a part to flip the cases so the base of the case is up instead of down, I will then drop them into a plate similar to the pick up plate in the case feeder. Then the camera can be above the case to take the pictures. Hopefully this avoids issues with dirt and dust falling on the camera lense which would happen if the cases were base down and the camera was underneath the cases. 



 

Edited by KKKenF
Link to comment
Share on other sites

On 11/22/2020 at 11:53 AM, KKKenF said:

Hopefully this avoids issues with dirt and dust falling on the camera lense which would happen if the cases were base down and the camera was underneath the cases.

Consider using a mirror to present the image to your camera.  No need to place either directly under the path of the empty shells.

Link to comment
Share on other sites

Thinking about the mirror idea, one other issue as I work throught it is how to hold the case in place without obsuring the headstamp. I think one method was to hold it above the rim. Will work on it this weekend. Arducam arrived in the mail this week so image testing can start soon.

Link to comment
Share on other sites

  • 2 months later...

I'm the guy who originally started this thread.   Life got in the way and I forgot all about it, I've moved twice, started a business...  And i've come full circle back here.  I rediscovered this thread thinking about tackling this problem again.  Very cool to see some of you have run with it and there's even a code sample!    I also hadn't been reloading much due to how cheap ammo was and how busy I've been, now i have multiple 5 gallon pails full of brass that it's time to sort.

 

I've started sketching up some ideas for sorting mechanisms in fusion360 to 3d print once i get my printer up and running by next month I hope.  So far i don't like any of the ideas I've come up with.  

 

Also messing around with some Computer Vision/Deep Learning frameworks which are honestly a bit above my paygrade at the moment.   Been playing around with both darknet/yolo and opencv and got some stuff that is a start going, but still needs a lot of work.   I'm going to look at the code Jakogut posted during my next bit of significant free time to see what I can learn.  My goal is to have something that will run off a single board computer like an Nvidia Jetson and a web interface, and not need a laptop plugged in to run it.

 

Hopefully in the next week or two I will find the time to make a jig to take consistent photos of 9mm brass.  i'm thinking of taking around 100 each of 4 different head-stamps.  Train an some code with half of the images and with a little luck get it to properly identify the other half of the images.

 

I've got this little arducam right now that i'm using to toy with: https://www.arducam.com/product/arducam-8mp-1080p-usb-autofocus-camera-module-1-4-cmos-imx219-mini-uvc-usb2-0-webcam-board-with-1m-usb-cable-for-windows-linux-android-and-mac-os-b0292/

 

 

Link to comment
Share on other sites

Finger Blaster - If you will go over to the Brian Enos classified section and look under vendors you will see one named A+ Brass.  Todd who is the owner might be able to provide you some guidance.  Todd has a vision system he uses today and he has sorted by head stamp over 80,000 pieces of 9mm brass for me.  Hope this helps provide you a jumpstart back into this really neat process.  Mark  

Edited by Sigarmsp226
Link to comment
Share on other sites

Not sure if you're on the reloading discord or not but they have a 3d printing section and the optical sorter has been in discussions lately and I know of at least one other guy working through this same issue right now.

 

I picked up 2 3d printers in the last few months and they have been great. So many little things you can make that you never knew you needed....

Link to comment
Share on other sites

9 hours ago, Intheshaw1 said:

I got on it last summer for the primer notifications and scored a few boxes and then I went down the slippery slope of 3d printing....

I joined as well, I searched earlier this week for a group like that and never found anything, so much appreaciated.

 

Just read thru this thread on headstamp sorting.  I only shoot 9 minor but still sort by headstamp for consistency and its my least favorite chore.  Love reading all your ideas, even if I can't really contribute.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...