Metadata-Version: 2.1
Name: imgraph
Version: 0.0.9
Summary: Graph Neural Network Library Built On Top Of  PyTorch and PyTorch Geometric
Author-email: Aryan Singh <aryan.singh@ul.ie>
Project-URL: homepage, https://aryan-at-ul.github.io
Project-URL: documentation, https://aryan-at-ul.github.io
Project-URL: repository, https://github.com/aryan-at-ul/imgraph.git
Keywords: deep-learning,pytorch,geometric-deep-learning,graph-neural-networks,graph-convolutional-networks,gnn-on-images,convert image to graph
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: yacs
Requires-Dist: hydra-core
Requires-Dist: protobuf (<4.21)
Requires-Dist: pytorch-lightning
Requires-Dist: huggingface-hub
Requires-Dist: ase
Requires-Dist: h5py
Requires-Dist: numba
Requires-Dist: sympy
Requires-Dist: pandas
Requires-Dist: captum
Requires-Dist: rdflib
Requires-Dist: trimesh
Requires-Dist: networkx
Requires-Dist: graphviz
Requires-Dist: tabulate
Requires-Dist: matplotlib
Requires-Dist: torchmetrics
Requires-Dist: scikit-image
Requires-Dist: pytorch-memlab
Requires-Dist: pgmpy
Requires-Dist: opt-einsum
Requires-Dist: statsmodels
Requires-Dist: opencv-python
Requires-Dist: timm
Requires-Dist: torchvision
Requires-Dist: torch
Requires-Dist: torch-geometric
Provides-Extra: benchmark
Requires-Dist: protobuf (<4.21) ; extra == 'benchmark'
Requires-Dist: wandb ; extra == 'benchmark'
Requires-Dist: pandas ; extra == 'benchmark'
Requires-Dist: networkx ; extra == 'benchmark'
Requires-Dist: matplotlib ; extra == 'benchmark'
Provides-Extra: dev
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: onnx ; extra == 'dev'
Requires-Dist: onnxruntime ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Provides-Extra: full
Requires-Dist: yacs ; extra == 'full'
Requires-Dist: hydra-core ; extra == 'full'
Requires-Dist: protobuf (<4.21) ; extra == 'full'
Requires-Dist: pytorch-lightning ; extra == 'full'
Requires-Dist: huggingface-hub ; extra == 'full'
Requires-Dist: ase ; extra == 'full'
Requires-Dist: h5py ; extra == 'full'
Requires-Dist: numba ; extra == 'full'
Requires-Dist: sympy ; extra == 'full'
Requires-Dist: pandas ; extra == 'full'
Requires-Dist: captum ; extra == 'full'
Requires-Dist: rdflib ; extra == 'full'
Requires-Dist: trimesh ; extra == 'full'
Requires-Dist: networkx ; extra == 'full'
Requires-Dist: graphviz ; extra == 'full'
Requires-Dist: tabulate ; extra == 'full'
Requires-Dist: matplotlib ; extra == 'full'
Requires-Dist: torchmetrics ; extra == 'full'
Requires-Dist: scikit-image ; extra == 'full'
Requires-Dist: pytorch-memlab ; extra == 'full'
Requires-Dist: pgmpy ; extra == 'full'
Requires-Dist: opt-einsum ; extra == 'full'
Requires-Dist: statsmodels ; extra == 'full'
Requires-Dist: opencv-python ; extra == 'full'
Requires-Dist: timm ; extra == 'full'
Requires-Dist: torchvision ; extra == 'full'
Requires-Dist: torch ; extra == 'full'
Requires-Dist: torch-geometric ; extra == 'full'
Provides-Extra: graphgym
Requires-Dist: yacs ; extra == 'graphgym'
Requires-Dist: hydra-core ; extra == 'graphgym'
Requires-Dist: protobuf (<4.21) ; extra == 'graphgym'
Requires-Dist: pytorch-lightning ; extra == 'graphgym'
Provides-Extra: modelhub
Requires-Dist: huggingface-hub ; extra == 'modelhub'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: onnx ; extra == 'test'
Requires-Dist: onnxruntime ; extra == 'test'

# IMGRAPH 

### Used for converting image to graph, uses superpixel method for node creation, extract features from CNN models. 

Example Usage: 

```
    from imgraph.pipeline import create_graph_pipleline

    path = "path/to/image"

    create_graph_pipleline(path, 'classification', 'rag', 'resnet18', 10)

```

### Above code will create a graph from the image and save it in the directory .~/cache/imgraph or directory specified by the user in enviornment variable IMGRAPH_HOME.


### Expected input folder structure: 

```
    image_folder
    ├── test
    │   ├── class1
    │   └── class2
    ├── train
    │   ├── class1
    │   └── class2
    └── val
        ├── class1
        └── class2
```


### The graph will be saved in the PyG Data format or pickle format.

### To install pytorch geometric dependencies, please follow the instructions here: [PyG installation](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html) or use the following code snippet:

### To install full dependeciens install using setup.py with full-dependencies flag (its slow, but will install all dependencies)
    
```
    import torch

    def format_pytorch_version(version):
    return version.split('+')[0]

    TORCH_version = torch.__version__
    TORCH = format_pytorch_version(TORCH_version)

    def format_cuda_version(version):
    return 'cu' + version.replace('.', '')

    CUDA_version = torch.version.cuda
    CUDA = format_cuda_version(CUDA_version)

    !pip install torch-scatter     -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html
    !pip install torch-sparse      -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html
    !pip install torch-cluster     -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html
    !pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html
    !pip install torch-geometric 

```




