Skip to content

DesignSparkRS/boxing-match

Repository files navigation

Boxing-match

Applied bin packing algo for RS x NVIDIA collaboration

This was a very quick prototype effort to validate the use of off the shelf algos to show value in the field for RS shipping. The computer vision part of the project was handled in another codebase. In this demo, we are showing a simple use of data management, some abstraction around the types of things to consider, as well as configuring some key restrictions in order to show that without giant compute we still get very good results.

The packages used are: plotly >= v5.5.0 (3d rendering, Mesh3d, HTML export including all the controls and such within the browser output file) pandas >= v1.3 (reading cvs files) numpy (used a little bit with the cuboid mesh generation) everything else should be stdlib.

I started out by using the 3D-bin-container library, but I ended up ditching it and doing some custom code that does roughly the same except using our specific abstractions directly in python. Given the simplifications, it still runs fairly fast, even without being compiled C++ like the library was. I'm sure that if we wanted to get fancier, we could configure this package and still be fine. For this test, I was iterating on the abstractions such that it was easier just to rip out some fast and loose code in order to prove the ideas, instead of ensuring an amazing performance level or clean coding.

Copy of header from main python file:

Rigid items ("rock" and "rug") placed geometrically using product dimensions. "rubble" items treated as pure volume — shown as voxels by default. PNG (Matplotlib) and interactive 3D HTML (Plotly) renderers. UI includes:

  • Class colors vs unique colors toggle
  • Fit view
  • Show/Hide rubble toggle
  • Voxel size cycling button
  • Step-through animation (Reset / Forward / Backward) with vertical slide-in Product name shown in hover text. Counts panel always visible, showing "(hidden)" if rubble voxels are hidden.

CSV formats

items.csv: weight,name,width,length,height,class,prod_width,prod_length,prod_height

boxes.csv: width,length,height,name

Classes:

  • "rock" : rigid, boxy.
  • "rug" : rigid, possibly rolled up.
  • "rubble" : malleable, volume filler.

Install

After making sure you have the libraries installed mentioned above, you simply must have the csv files you require and the main python file in the same project directory. If you want to use the HTML output file, you then also need the boxviz.js file in the same directory. There are examples below for command line execution.

Usage

The command line parameters and defaults are: def main( items_csv, boxes_csv, out_png=None, dpi=180, out_html=None, png_color_mode="class", hide_rubble=False, rubble_voxel_size=20):

example uses:

python cartonize_v3.py --items items.csv --boxes boxes.csv --out packing.png --html packing.html

python cartonize_v3.py --rubble-voxel-size 20

Contributing

PRs accepted.

License

MIT © Richard McRichface

About

Nvidia Jetson AI powered - "Tetris packing"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published