jtheiner / legobrickclassification Goto Github PK
View Code? Open in Web Editor NEWRepository to identify Lego bricks automatically only using images
Repository to identify Lego bricks automatically only using images
like capture multi pictures in different angels once?
The code example in the readme shows this command:
blender -b -P dataset/blender/render.py -- -i 9.dat --save ./ --images_per_brick 1 --config thumbnail-example.json
However, the repo is missing thumbnail-example.json or the readme does not indicate how to make one or what it should contain.
I've been trying to get the rendering through blender to work. After some tinkering with blender version (->2.79!) and the matching older version of the LDraw Addon I was able to manually render parts from ldraw inside the blender UI. I couldn't get the render.py
script to work though. It seems to start rendering. The render doesn't finish though. So far I've waited about an hour for a single image. There is no CPU and GPU usage by blender or the script, so I suspect it is blocked somehow. This is the output:
❯ /Applications/Blender-2.79.app/Contents/MacOS/blender -b -P dataset/blender/render.py -- -i /usr/local/share/ldraw/parts/30237.dat --save ./ --images_per_brick 1 --config thumbnail.json
Blender 2.79 (sub 7) (hash e045fe53f1b0 built 2019-07-29 01:37:23)
Read prefs: /Users/stefanfoulis/Library/Application Support/Blender/2.79/config/userpref.blend
found bundled python: /Applications/Blender-2.79.app/Contents/Resources/2.79/python
numpy version: 1.15.0
2021-02-03 09:21:02,303 [INFO] config file: thumbnail.json
09:21:02.30 [importldraw] The LDraw Parts Library path to be used is: /usr/local/share/ldraw
Info: 09:21:02.30 [importldraw] The LDraw Parts Library path to be used is: /usr/local/share/ldraw
09:21:02.30 [importldraw] Use LSynth Parts requested
Info: 09:21:02.30 [importldraw] Use LSynth Parts requested
09:21:02.30 [importldraw] Standard-res primitives selected
Info: 09:21:02.30 [importldraw] Standard-res primitives selected
09:21:02.30 [importldraw] Loading stud files
Info: 09:21:02.30 [importldraw] Loading stud files
09:21:02.31 [importldraw] Loading files
Info: 09:21:02.31 [importldraw] Loading files
09:21:02.38 [importldraw] Creating NodeGroups
Info: 09:21:02.38 [importldraw] Creating NodeGroups
09:21:02.38 [importldraw] createBlenderDistanceToCenterNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderDistanceToCenterNodeGroup #create
09:21:02.38 [importldraw] createBlenderVectorElementPowerNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderVectorElementPowerNodeGroup #create
09:21:02.38 [importldraw] createBlenderConvertToNormalsNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderConvertToNormalsNodeGroup #create
09:21:02.38 [importldraw] createBlenderConcaveWallsNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderConcaveWallsNodeGroup #create
09:21:02.38 [importldraw] createBlenderSlopeTextureNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderSlopeTextureNodeGroup #create
09:21:02.38 [importldraw] createBlenderFresnelNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderFresnelNodeGroup #create
09:21:02.38 [importldraw] createBlenderReflectionNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderReflectionNodeGroup #create
09:21:02.38 [importldraw] createBlenderDielectricNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderDielectricNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoStandardNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoStandardNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoTransparentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoTransparentNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoTransparentFluorescentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoTransparentFluorescentNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoRubberNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoRubberNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoRubberTranslucentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoRubberTranslucentNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoEmissionNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoEmissionNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoChromeNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoChromeNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoPearlescentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoPearlescentNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoMetalNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoMetalNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoGlitterNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoGlitterNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoSpeckleNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoSpeckleNodeGroup #create
09:21:02.38 [importldraw] createBlenderLegoMilkyWhiteNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoMilkyWhiteNodeGroup #create
09:21:02.39 [importldraw] Creating Blender objects
Info: 09:21:02.39 [importldraw] Creating Blender objects
09:21:02.44 [importldraw] Number of vertices: 1399
Info: 09:21:02.44 [importldraw] Number of vertices: 1399
09:21:02.44 [importldraw] Number of vertices of convex hull: 47
Info: 09:21:02.44 [importldraw] Number of vertices of convex hull: 47
09:21:02.44 [importldraw] Centre object
Info: 09:21:02.44 [importldraw] Centre object
09:21:02.44 [importldraw] Adding 1 objects to scene
Info: 09:21:02.44 [importldraw] Adding 1 objects to scene
09:21:02.45 [importldraw] Load Done
Info: 09:21:02.45 [importldraw] Load Done
Info: 09:21:02.30 [importldraw] The LDraw Parts Library path to be used is: /usr/local/share/ldraw
Info: 09:21:02.30 [importldraw] Use LSynth Parts requested
Info: 09:21:02.30 [importldraw] Standard-res primitives selected
Info: 09:21:02.30 [importldraw] Loading stud files
Info: 09:21:02.31 [importldraw] Loading files
Info: 09:21:02.38 [importldraw] Creating NodeGroups
Info: 09:21:02.38 [importldraw] createBlenderDistanceToCenterNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderVectorElementPowerNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderConvertToNormalsNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderConcaveWallsNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderSlopeTextureNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderFresnelNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderReflectionNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderDielectricNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoStandardNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoTransparentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoTransparentFluorescentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoRubberNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoRubberTranslucentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoEmissionNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoChromeNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoPearlescentNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoMetalNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoGlitterNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoSpeckleNodeGroup #create
Info: 09:21:02.38 [importldraw] createBlenderLegoMilkyWhiteNodeGroup #create
Info: 09:21:02.39 [importldraw] Creating Blender objects
Info: 09:21:02.44 [importldraw] Number of vertices: 1399
Info: 09:21:02.44 [importldraw] Number of vertices of convex hull: 47
Info: 09:21:02.44 [importldraw] Centre object
Info: 09:21:02.44 [importldraw] Adding 1 objects to scene
Info: 09:21:02.45 [importldraw] Load Done
2021-02-03 09:21:02,455 [INFO] initialized world successfully
initialized world successfully
2021-02-03 09:21:02,463 [INFO] start rendering 1 images
start rendering 1 images
Fra:1 Mem:12.42M (0.00M, Peak 12.42M) | Time:00:00.00 | Preparing Scene data
Fra:1 Mem:12.92M (0.00M, Peak 15.24M) | Time:00:00.00 | Preparing Scene data
Fra:1 Mem:12.92M (0.00M, Peak 15.24M) | Time:00:00.00 | Creating Shadowbuffers
Fra:1 Mem:12.92M (0.00M, Peak 15.24M) | Time:00:00.00 | Raytree.. preparing
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.00 | Raytree.. building
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Raytree finished
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Creating Environment maps
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Caching Point Densities
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Sce: Scene Ve:2518 Fa:2603 La:2
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Loading voxel datasets
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Sce: Scene Ve:2518 Fa:2603 La:2
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Sce: Scene Ve:2518 Fa:2603 La:2
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Volume preprocessing
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Sce: Scene Ve:2518 Fa:2603 La:2
Fra:1 Mem:13.28M (0.00M, Peak 15.24M) | Time:00:00.01 | Sce: Scene Ve:2518 Fa:2603 La:2
After a few hours I hit ctrl-c
:
^C
Sent an internal break event. Press ^C again to kill Blender
But that didn't end either. Had to ctrl-c
again to kill the process, which worked.
Any ideas what I might have missed?
macOS 11.1 on MacBook Pro (15-inch, 2017), 3.1 GHz Quad-Core Intel Core i7, 16 GB 2133 MHz LPDDR3, Radeon Pro 560 4 GB
File "dataset/generate_dataset.py", line 20
def _render(idx_fname, output_path: str, list_length: int, config_fname: str, number_of_images=1):
^
SyntaxError: invalid syntax
How to solve?
When I try to generate the full data set with python dataset/generate_dataset.py
I get the error:
Traceback (most recent call last):
File "dataset/generate_dataset.py", line 13, in <module>
df = pd.read_csv(dataset_path, encoding='utf-8', index_col='id')
File "/home/alex/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/parsers.py", line 685, in parser_f
return _read(filepath_or_buffer, kwds)
File "/home/alex/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/parsers.py", line 457, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File "/home/alex/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/parsers.py", line 895, in __init__
self._make_engine(self.engine)
File "/home/alex/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/parsers.py", line 1135, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/home/alex/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/parsers.py", line 1906, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 380, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 687, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File b'data/dataset-15/dataset.csv' does not exist: b'data/dataset-15/dataset.csv'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.