Downloads · 30 days
7
44% of all-time downloads
Sushmey/shapenet-model
shapenet-model is a machine learning model from Sushmey. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A comprehensive system for reconstructing 3D objects from 2D images using deep learning. This system is designed to work with ShapeNet datasets and provides both single-view and multi-view reconstruction capabilities.
Downloads · 30 days
7
44% of all-time downloads
All-time downloads
16
Public
Repo size
336 MB
Likes
0
Public
Click a slice to open those files.
.pth333 MB · 96%
From the Hugging Face model README
A comprehensive system for reconstructing 3D objects from 2D images using deep learning. This system is designed to work with ShapeNet datasets and provides both single-view and multi-view reconstruction capabilities.
The system consists of several key components:
data_preprocessing.py): Converts 3D models to 2D renderingsmodel_architecture.py): Neural network implementationstraining_pipeline.py): Training and validation loopsinference_system.py): Model inference and 3D generationvisualization_tools.py): Interactive 3D viewers and comparisonsmain.py): Unified command-line interfaceClone the repository:
git clone <repository-url>
cd shapenet
Create and activate virtual environment:
python -m venv shapenet_venv
source shapenet_venv/bin/activate # On Windows: shapenet_venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
First, preprocess your ShapeNet dataset to generate 2D renderings:
python main.py preprocess
This will:
Train the reconstruction model:
python main.py train
This will:
Generate 3D models from 2D images:
# Single image
python main.py inference --input path/to/image.jpg --output results/
# Multiple images
python main.py inference --input path/to/images/ --output results/
Execute the complete pipeline:
python main.py pipeline --input path/to/test_image.jpg
from main import ReconstructionSystem
# Initialize system
system = ReconstructionSystem()
# Preprocess data
system.preprocess_data()
# Train model
system.train_model()
# Run inference
system.run_inference('input_image.jpg', 'output_dir/')
# Evaluate model
system.evaluate_model()
from inference_system import InferenceEngine
from visualization_tools import ReconstructionVisualizer
# Load trained model
engine = InferenceEngine('checkpoints/best_model.pth')
# Generate 3D from image
results = engine.generate_3d_from_single_view('image.jpg')
# Visualize results
visualizer = ReconstructionVisualizer()
fig = visualizer.create_interactive_plotly_viz(
voxels=results['voxels'],
pointcloud=results['pointcloud']
)
fig.show()
Create a config.json file to customize the system:
{
"data_path": "/path/to/shapenet",
"processed_data_path": "/path/to/processed_data",
"checkpoint_dir": "/path/to/checkpoints",
"output_dir": "/path/to/outputs",
"model_type": "single_view",
"num_views": 12,
"image_size": 224,
"voxel_size": 32,
"num_points": 2048,
"batch_size": 4,
"learning_rate": 0.001,
"num_epochs": 100
}
model_type: "single_view"model_type: "multi_view"The system generates 3D reconstructions in multiple formats:
shapenet/
├── data_preprocessing.py # Data preprocessing pipeline
├── model_architecture.py # Neural network architectures
├── training_pipeline.py # Training and validation
├── inference_system.py # Model inference
├── visualization_tools.py # Visualization utilities
├── main.py # Main interface
├── requirements.txt # Dependencies
├── config.json # Configuration file
├── README.md # This file
├── PartSym dataset/ # Your ShapeNet dataset
├── processed_data/ # Preprocessed data
├── checkpoints/ # Model checkpoints
└── outputs/ # Inference results
CUDA Out of Memory:
Missing Dependencies:
pip install -r requirements.txtData Loading Errors:
Enable debug logging:
import logging
logging.basicConfig(level=logging.DEBUG)
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this system in your research, please cite:
@software{shapenet_reconstruction,
title={2D to 3D Reconstruction System},
author={Your Name},
year={2024},
url={https://github.com/yourusername/shapenet}
}