wyn-keras


Namewyn-keras JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryOur customized keras package for popular image classifier techniques.
upload_time2024-07-19 21:42:00
maintainerNone
docs_urlNone
authorYiqiao Yin
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # wyn-keras 🎉

A Python package for building and experimenting with Popular Convolutional Neural Networks (CNN) and Vision Transformer (ViT) models using TensorFlow and Keras.

## Directory Structure 📁

```
wyn-keras/
├── pyproject.toml
├── README.md
├── wyn_keras
│   ├── __init__.py
│   ├── vgg16.py
│   ├── resnet.py
│   ├── densenet.py
│   ├── inception.py
│   └── vit.py
├── tests
│   └── __init__.py
└── .gitignore
```

## Installation Instructions (From `PIP`) 📦

To install the package from PyPI, use the following command:

```sh
pip install wyn-keras
```

For more information, visit the [PyPI page](https://pypi.org/project/wyn-keras/).

## Installation Instructions (Local) 📦

To install the package and its dependencies, use [Poetry](https://python-poetry.org/):

```sh
# Install Poetry if you haven't already
curl -sSL https://install.python-poetry.org | python3 -

# Install the package
poetry install
```

## Usage 🚀

### Vision Transformer

The `ViT` class allows you to create and train Vision Transformer models.

### VGG16

The `VGG16` class allows you to create and train VGG16 models.

### ResNet

The `ResNet50` class allows you to create and train ResNet50 models.

### DenseNet

The `DenseNet121` class allows you to create and train DenseNet121 models.

### InceptionV3

The `InceptionV3Model` class allows you to create and train InceptionV3 models.

### Additional Functions (Coming Soon...) 🚧

Stay tuned for more functionalities to be added in the future!

## Example Usage 📚

### Vision Transformer

```python
import tensorflow as tf
from wyn_keras.vit import ViT

# Load and preprocess the MNIST dataset
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train[..., tf.newaxis].astype("float32") / 255.0
x_test = x_test[..., tf.newaxis].astype("float32") / 255.0

# Number of classes in MNIST dataset
num_classes = 10

# Create an instance of the ViT class
vit_model = ViT(num_classes=num_classes, input_shape=(28, 28, 1), image_size=28, num_epochs=2)

# Create the ViT model
model = vit_model.create_vit_classifier()

# Train the model
history = vit_model.run_experiment(model, x_train, y_train, x_test, y_test)

# Plot patches
vit_model.plot_patches(x_test)
```

### VGG16

```python
from wyn_keras.vgg16 import VGG16

# Define the input shape and number of classes
input_shape = (32, 32, 3)
num_classes = 10

# Create an instance of the VGG16 class
vgg16_instance = VGG16(input_shape=input_shape, num_classes=num_classes)

# Build the model
model_vgg16 = vgg16_instance.build_model()

# Print the model summary
model_vgg16.summary()
```

### ResNet

```python
from wyn_keras.resnet import ResNet50

# Define the input shape, number of classes, kernel size, filters, and strides
input_shape = (224, 224, 3)
num_classes = 1000
kernel_size = 3
filters = [64, 64, 256]
strides = (2, 2)

# Create an instance of the ResNet50 class
resnet_instance = ResNet50(input_shape=input_shape, num_classes=num_classes, kernel_size=kernel_size, filters=filters, strides=strides)

# Build the model
model_resnet = resnet_instance.build_model()

# Print the model summary
model_resnet.summary()
```

### DenseNet

```python
from wyn_keras.densenet import DenseNet121

# Define the input shape, number of classes, growth rate, and compression factor
input_shape = (224, 224, 3)
num_classes = 1000
growth_rate = 32
compression_factor = 0.5

# Create an instance of the DenseNet121 class
densenet_instance = DenseNet121(input_shape=input_shape, num_classes=num_classes, growth_rate=growth_rate, compression_factor=compression_factor)

# Build the model
model_densenet = densenet_instance.build_model()

# Print the model summary
model_densenet.summary()
```

### InceptionV3

```python
from wyn_keras.inception import InceptionV3Model

# Define the input shape, number of classes, and resize shape
input_shape = (32, 32, 3)
num_classes = 10
resize_shape = (75, 75)

# Create an instance of the InceptionV3Model class
inception_instance = InceptionV3Model(input_shape=input_shape, num_classes=num_classes, resize_shape=resize_shape)

# Build the model
model_inception = inception_instance.build_model()

# Print the model summary
model_inception.summary()
```

## Author ✍️

**Yiqiao Yin**  
Email: [eagle0504@gmail.com](mailto:eagle0504@gmail.com)  
Personal Site: [https://www.y-yin.io/](https://www.y-yin.io/)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wyn-keras",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Yiqiao Yin",
    "author_email": "eagle0504@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6a/38/fec4fd876010de7ce6c0a350795d410f79c7a9bfa34ab9e934ae114c6b14/wyn_keras-0.2.0.tar.gz",
    "platform": null,
    "description": "# wyn-keras \ud83c\udf89\n\nA Python package for building and experimenting with Popular Convolutional Neural Networks (CNN) and Vision Transformer (ViT) models using TensorFlow and Keras.\n\n## Directory Structure \ud83d\udcc1\n\n```\nwyn-keras/\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 wyn_keras\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 vgg16.py\n\u2502   \u251c\u2500\u2500 resnet.py\n\u2502   \u251c\u2500\u2500 densenet.py\n\u2502   \u251c\u2500\u2500 inception.py\n\u2502   \u2514\u2500\u2500 vit.py\n\u251c\u2500\u2500 tests\n\u2502   \u2514\u2500\u2500 __init__.py\n\u2514\u2500\u2500 .gitignore\n```\n\n## Installation Instructions (From `PIP`) \ud83d\udce6\n\nTo install the package from PyPI, use the following command:\n\n```sh\npip install wyn-keras\n```\n\nFor more information, visit the [PyPI page](https://pypi.org/project/wyn-keras/).\n\n## Installation Instructions (Local) \ud83d\udce6\n\nTo install the package and its dependencies, use [Poetry](https://python-poetry.org/):\n\n```sh\n# Install Poetry if you haven't already\ncurl -sSL https://install.python-poetry.org | python3 -\n\n# Install the package\npoetry install\n```\n\n## Usage \ud83d\ude80\n\n### Vision Transformer\n\nThe `ViT` class allows you to create and train Vision Transformer models.\n\n### VGG16\n\nThe `VGG16` class allows you to create and train VGG16 models.\n\n### ResNet\n\nThe `ResNet50` class allows you to create and train ResNet50 models.\n\n### DenseNet\n\nThe `DenseNet121` class allows you to create and train DenseNet121 models.\n\n### InceptionV3\n\nThe `InceptionV3Model` class allows you to create and train InceptionV3 models.\n\n### Additional Functions (Coming Soon...) \ud83d\udea7\n\nStay tuned for more functionalities to be added in the future!\n\n## Example Usage \ud83d\udcda\n\n### Vision Transformer\n\n```python\nimport tensorflow as tf\nfrom wyn_keras.vit import ViT\n\n# Load and preprocess the MNIST dataset\n(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()\nx_train = x_train[..., tf.newaxis].astype(\"float32\") / 255.0\nx_test = x_test[..., tf.newaxis].astype(\"float32\") / 255.0\n\n# Number of classes in MNIST dataset\nnum_classes = 10\n\n# Create an instance of the ViT class\nvit_model = ViT(num_classes=num_classes, input_shape=(28, 28, 1), image_size=28, num_epochs=2)\n\n# Create the ViT model\nmodel = vit_model.create_vit_classifier()\n\n# Train the model\nhistory = vit_model.run_experiment(model, x_train, y_train, x_test, y_test)\n\n# Plot patches\nvit_model.plot_patches(x_test)\n```\n\n### VGG16\n\n```python\nfrom wyn_keras.vgg16 import VGG16\n\n# Define the input shape and number of classes\ninput_shape = (32, 32, 3)\nnum_classes = 10\n\n# Create an instance of the VGG16 class\nvgg16_instance = VGG16(input_shape=input_shape, num_classes=num_classes)\n\n# Build the model\nmodel_vgg16 = vgg16_instance.build_model()\n\n# Print the model summary\nmodel_vgg16.summary()\n```\n\n### ResNet\n\n```python\nfrom wyn_keras.resnet import ResNet50\n\n# Define the input shape, number of classes, kernel size, filters, and strides\ninput_shape = (224, 224, 3)\nnum_classes = 1000\nkernel_size = 3\nfilters = [64, 64, 256]\nstrides = (2, 2)\n\n# Create an instance of the ResNet50 class\nresnet_instance = ResNet50(input_shape=input_shape, num_classes=num_classes, kernel_size=kernel_size, filters=filters, strides=strides)\n\n# Build the model\nmodel_resnet = resnet_instance.build_model()\n\n# Print the model summary\nmodel_resnet.summary()\n```\n\n### DenseNet\n\n```python\nfrom wyn_keras.densenet import DenseNet121\n\n# Define the input shape, number of classes, growth rate, and compression factor\ninput_shape = (224, 224, 3)\nnum_classes = 1000\ngrowth_rate = 32\ncompression_factor = 0.5\n\n# Create an instance of the DenseNet121 class\ndensenet_instance = DenseNet121(input_shape=input_shape, num_classes=num_classes, growth_rate=growth_rate, compression_factor=compression_factor)\n\n# Build the model\nmodel_densenet = densenet_instance.build_model()\n\n# Print the model summary\nmodel_densenet.summary()\n```\n\n### InceptionV3\n\n```python\nfrom wyn_keras.inception import InceptionV3Model\n\n# Define the input shape, number of classes, and resize shape\ninput_shape = (32, 32, 3)\nnum_classes = 10\nresize_shape = (75, 75)\n\n# Create an instance of the InceptionV3Model class\ninception_instance = InceptionV3Model(input_shape=input_shape, num_classes=num_classes, resize_shape=resize_shape)\n\n# Build the model\nmodel_inception = inception_instance.build_model()\n\n# Print the model summary\nmodel_inception.summary()\n```\n\n## Author \u270d\ufe0f\n\n**Yiqiao Yin**  \nEmail: [eagle0504@gmail.com](mailto:eagle0504@gmail.com)  \nPersonal Site: [https://www.y-yin.io/](https://www.y-yin.io/)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Our customized keras package for popular image classifier techniques.",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "368a48a6dfbab7c7db59c8aa81f087e69ac43cdba54f897b0e71bd1cc3f6b4b9",
                "md5": "2b1937d0513d61bf24fc7b765a8b373c",
                "sha256": "d8b42ca36b9d542f51a85462db5488c2214555ff99e9dc72ac271c5b382180bf"
            },
            "downloads": -1,
            "filename": "wyn_keras-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b1937d0513d61bf24fc7b765a8b373c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 9477,
            "upload_time": "2024-07-19T21:41:58",
            "upload_time_iso_8601": "2024-07-19T21:41:58.705053Z",
            "url": "https://files.pythonhosted.org/packages/36/8a/48a6dfbab7c7db59c8aa81f087e69ac43cdba54f897b0e71bd1cc3f6b4b9/wyn_keras-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a38fec4fd876010de7ce6c0a350795d410f79c7a9bfa34ab9e934ae114c6b14",
                "md5": "05aa7be23679bbe13ad5797855b34e05",
                "sha256": "449cbe6e86ba6d3980a9a44d9e36c7de9bdfdbf89abf7bfa91761b8978312f35"
            },
            "downloads": -1,
            "filename": "wyn_keras-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "05aa7be23679bbe13ad5797855b34e05",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 8259,
            "upload_time": "2024-07-19T21:42:00",
            "upload_time_iso_8601": "2024-07-19T21:42:00.029957Z",
            "url": "https://files.pythonhosted.org/packages/6a/38/fec4fd876010de7ce6c0a350795d410f79c7a9bfa34ab9e934ae114c6b14/wyn_keras-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 21:42:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wyn-keras"
}
        
Elapsed time: 0.26692s