CurveShapeNet is a versatile toolkit for analyzing 2D shapes, offering features like shape detection, symmetry analysis, curve completion, and shape recognition using deep learning models.
CurveShapeNet processes and analyzes 2D shapes represented as polylines. The main functionalities include:
- Shape Regularization: Identifying and classifying geometric shapes such as circles, ellipses, rectangles, polygons, and stars.
- Symmetry Detection: Detecting reflective and rotational symmetries in shapes.
- Curve Completion: Completing missing parts of shapes through interpolation.
- Shape Recognition: Training a neural network to recognize and classify shapes from images of their polylines.
curve_project/
│
├── data/
│ ├── isolated.csv
│ ├── circle.csv
│ ├── ellipse.csv
│ ├── star.csv
│ ├── rectangle.csv
│ ├── polyfon.csv
│ ├── frag0.csv
│ ├── frag1.csv
│ ├── occlusion1.csv
│ ├── occlusion2.csv
│
├── model/
│ └── shape_recognition_model.pth
│
├── scripts/
│ ├── main.py
│ ├── curve_regularization.py
│ ├── symmetry_detection.py
│ ├── curve_completion.py
│ ├── train_model.py
│ └── utils.py
│
└── output/
└── predictions/
To set up the project environment, follow these steps:
-
Clone the Repository:
git clone https://github.com/your_username/CurveShapeNet.git cd CurveShapeNet -
Install Dependencies: Install all required libraries using pip:
pip install numpy matplotlib scipy torch torchvision pillow scikit-learn
-
Mount Google Drive (Optional, for Colab users): If you're using Google Colab, you can mount your Google Drive to save outputs and access datasets:
from google.colab import drive drive.mount('/content/drive')
- Script:
curve_regularization.py - Functionality: Identifies and classifies geometric shapes from a set of points.
- Run Example:
- Load your dataset, call
identify_shapes, and get a list of detected shapes.
- Load your dataset, call
- Script:
symmetry_detection.py - Functionality: Detects reflective and rotational symmetries in shapes.
- Run Example:
- Load your dataset, call
detect_symmetry, and get symmetry details.
- Load your dataset, call
- Script:
curve_completion.py - Functionality: Completes missing parts of shapes using interpolation.
- Run Example:
- Load your dataset, call
complete_curve, and plot or save completed shapes.
- Load your dataset, call
- Script:
train_model.py - Functionality: Trains a ResNet-18 model to recognize and classify shapes.
- Run Example:
- Point to your dataset, run the script to start training, and save the model.
- Script:
main.py - Functionality: Uses the trained model to predict the shape of new data.
- Run Example:
- Load new data, run the script, and save prediction results as images.
- Prepare Your Dataset: Ensure your dataset is in CSV format, with each row representing a point in a shape (X, Y coordinates).
- Execute the Scripts: Run the scripts in the order mentioned above, starting with data processing, then training the model, and finally making predictions.
CurveShapeNet provides a comprehensive toolset for working with 2D shapes, from identifying and regularizing shapes to detecting symmetries, completing curves, and recognizing shapes using deep learning models. It is a solid foundation for research projects, computer vision applications, or any shape analysis tasks.