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

Machine vision to sort by headstamp


Recommended Posts

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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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.

Guest
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...