summaryrefslogtreecommitdiff
path: root/python-augmentation-engine.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-31 07:16:13 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-31 07:16:13 +0000
commit8f53d7d05e1e4dee6c3d88350885b03455ca13e4 (patch)
tree250db091e15b0cb0fded14b5f6ae6297b3cc9208 /python-augmentation-engine.spec
parent40194ff7f9f21d2faedb63bb9fd2a4c5aa35899e (diff)
automatic import of python-augmentation-engine
Diffstat (limited to 'python-augmentation-engine.spec')
-rw-r--r--python-augmentation-engine.spec815
1 files changed, 815 insertions, 0 deletions
diff --git a/python-augmentation-engine.spec b/python-augmentation-engine.spec
new file mode 100644
index 0000000..b6d91ef
--- /dev/null
+++ b/python-augmentation-engine.spec
@@ -0,0 +1,815 @@
+%global _empty_manifest_terminate_build 0
+Name: python-augmentation-engine
+Version: 0.1.2
+Release: 1
+Summary: Solar Filaments data augmentation demo package
+License: MIT License
+URL: https://bitbucket.org/gsudmlab/augmentation_engine/src/master/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e3/6e/7349c0218e5af7f68c817c6391d161b2295d7f2ba5ad9d063e6c887b0dfc/augmentation_engine-0.1.2.tar.gz
+BuildArch: noarch
+
+Requires: python3-sortedcontainers
+Requires: python3-opencv-python
+Requires: python3-torchvision
+Requires: python3-pillow
+Requires: python3-pycocotools
+
+%description
+```python
+pip install augmentation_engine
+```
+ Requirement already satisfied: augmentation_engine in d:\gsu_assignments\semester_2\dl\augmentation_engine (0.0.1)
+ Requirement already satisfied: sortedcontainers in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (2.4.0)
+ Requirement already satisfied: opencv_python in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (4.5.3.56)
+ Requirement already satisfied: torchvision in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (0.10.0)
+ Requirement already satisfied: pillow in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (8.3.2)
+ Requirement already satisfied: numpy>=1.17.3 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from opencv_python->augmentation_engine) (1.21.2)
+ Requirement already satisfied: torch==1.9.0 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torchvision->augmentation_engine) (1.9.0)
+ Requirement already satisfied: typing-extensions in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torch==1.9.0->torchvision->augmentation_engine) (3.10.0.2)
+ Note: you may need to restart the kernel to use updated packages.
+### Import Required Libraries
+```python
+import os
+from torchvision import transforms
+import matplotlib.pyplot as plt
+from filament_augmentation.loader.filament_dataloader import FilamentDataLoader
+from filament_augmentation.generator.filament_dataset import FilamentDataset
+from filament_augmentation.metadata.filament_metadata import FilamentMetadata
+```
+**To find out the number of left, right and unidentified chiralities for an interval of time.**
+- The code snippet below gives the *chirality distribution*, i.e., the distribution of left, right and unidentified chiralities for an interval of time from "2015-08-01 17:36:15" to "2015-08-09 18:15:17".
+- Here the petdata has big bear space observatory(BBSO) full disk solar images from (01-09) aug 2015.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+- The ann_file or annotation file is a H-alpha based manually labelled filaments in a json file comes with petdata.
+```python
+__file__ = 'augmentation_process.ipynb'
+bbso_json = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), 'petdata', 'bbso_json_data','2015_chir_data.json'))
+filamentInfo = FilamentMetadata(ann_file = bbso_json, start_time = '2015-08-01 00:00:15',
+ end_time = '2015-08-30 23:59:59')
+filamentInfo.get_chirality_distribution()
+```
+ (22, 30, 186)
+- In order to generate extra filaments for left, right or unidentified chirality by either balancing the data or getting them in required ratios to train them using an ML algorithm. A filament dataset class should be initialized which is quite similar to that of pytorch dataset class.
+- The transform list should be list of torchvision [transformations](https://pytorch.org/vision/0.8/transforms.html)
+- Filament ratio is tuple variable that takes (L,R,U).
+### Initializing Filament dataset
+To initialize filament dataset class follow parameters are required:
+- bbso_path - BBSO full disk H-alpha solar images comes with petdata, path of the folder.
+- ann_file - a H-alpha based manually labelled filaments in a json file comes with petdata.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+```python
+bbso_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'petdata', '2015'))
+dataset = FilamentDataset(bbso_path = bbso_path, ann_file = bbso_json,
+ start_time = "2015-08-01 17:36:15", end_time = "2015-08-09 17:36:15")
+```
+ loading annotations into memory...
+ Done (t=0.07s)
+ creating index...
+ index created!
+### Setup transformations for data augmentation
+The transformations function can be refered from [torchvision transforms](https://pytorch.org/vision/0.8/transforms.html)
+- Here transforms variable should have list of torchvision transforms functions as shown below:
+```python
+transforms1 = [
+ transforms.ColorJitter(brightness=(0.25,1.25), contrast=(0.25,2.00), saturation=(0.25,2.25)),
+ transforms.RandomRotation(15,expand=False,fill=110)
+]
+```
+### Initializing data loader
+- dataset = object of filament dataset class.
+- batch_size = number of filaments to be generated per batch.
+- filament_ratio = tuple of three values, i.e., ratios of left, right and unidentified chirality to be generated in each batch.
+- n_batchs = number of batchs.
+- transforms = list of torchvision transformations functions
+- image_dim = image dimensions if image dimension is -1 then image will not be resize, i.e., output is original image size.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),n_batchs = 10,
+ transforms = transforms1, image_dim = 224)
+```
+#### How to generate 3 filament images for every batch with ratio of left as 1, right chirality as 1 and unidentified as 1 for 10 batches with original image dimension and display the images?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),
+ n_batchs = 10, transforms = transforms1, image_dim = -1)
+```
+#### Batch -1 augmented filament images and their following labels (1=R, 0= U, -1=L)
+```python
+for original_imgs, transformed_imgs, labels in data_loader:
+ for org_img, img, label in zip(original_imgs ,transformed_imgs, labels):
+ print("Original image")
+ plt.imshow(org_img, cmap='gray')
+ plt.show()
+ print("Transformed image")
+ plt.imshow(img, cmap='gray')
+ plt.show()
+ print("Label",label)
+ break
+```
+ Original image
+![png](document_images/output_18_1.png)
+ Transformed image
+![png](document_images/output_18_3.png)
+ Label 0
+ Original image
+![png](document_images/output_18_5.png)
+ Transformed image
+![png](document_images/output_18_7.png)
+ Label 1
+ Original image
+![png](document_images/output_18_9.png)
+ Transformed image
+![png](document_images/output_18_11.png)
+ Label -1
+#### How to generate 12 filament images for every batch with ratio of left as 2, right chirality as 3 and unidentified as 1 for 5 batches with image dimension of 224x224 ?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 12 , filament_ratio = (2, 3, 1),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+#### How to generate 10 filament images for every batch only for left and right chirality for 5 batches with image dimension of 224x224 ?
+- In order to remove one type of chiraity, filament ratio, i.e., tuple(L, R, U):
+ - if L=0 that means left chirality is eliminated. Similarly, this applies to other types as well.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 10 , filament_ratio = (1, 1, 0),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [-1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+
+%package -n python3-augmentation-engine
+Summary: Solar Filaments data augmentation demo package
+Provides: python-augmentation-engine
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-augmentation-engine
+```python
+pip install augmentation_engine
+```
+ Requirement already satisfied: augmentation_engine in d:\gsu_assignments\semester_2\dl\augmentation_engine (0.0.1)
+ Requirement already satisfied: sortedcontainers in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (2.4.0)
+ Requirement already satisfied: opencv_python in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (4.5.3.56)
+ Requirement already satisfied: torchvision in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (0.10.0)
+ Requirement already satisfied: pillow in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (8.3.2)
+ Requirement already satisfied: numpy>=1.17.3 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from opencv_python->augmentation_engine) (1.21.2)
+ Requirement already satisfied: torch==1.9.0 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torchvision->augmentation_engine) (1.9.0)
+ Requirement already satisfied: typing-extensions in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torch==1.9.0->torchvision->augmentation_engine) (3.10.0.2)
+ Note: you may need to restart the kernel to use updated packages.
+### Import Required Libraries
+```python
+import os
+from torchvision import transforms
+import matplotlib.pyplot as plt
+from filament_augmentation.loader.filament_dataloader import FilamentDataLoader
+from filament_augmentation.generator.filament_dataset import FilamentDataset
+from filament_augmentation.metadata.filament_metadata import FilamentMetadata
+```
+**To find out the number of left, right and unidentified chiralities for an interval of time.**
+- The code snippet below gives the *chirality distribution*, i.e., the distribution of left, right and unidentified chiralities for an interval of time from "2015-08-01 17:36:15" to "2015-08-09 18:15:17".
+- Here the petdata has big bear space observatory(BBSO) full disk solar images from (01-09) aug 2015.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+- The ann_file or annotation file is a H-alpha based manually labelled filaments in a json file comes with petdata.
+```python
+__file__ = 'augmentation_process.ipynb'
+bbso_json = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), 'petdata', 'bbso_json_data','2015_chir_data.json'))
+filamentInfo = FilamentMetadata(ann_file = bbso_json, start_time = '2015-08-01 00:00:15',
+ end_time = '2015-08-30 23:59:59')
+filamentInfo.get_chirality_distribution()
+```
+ (22, 30, 186)
+- In order to generate extra filaments for left, right or unidentified chirality by either balancing the data or getting them in required ratios to train them using an ML algorithm. A filament dataset class should be initialized which is quite similar to that of pytorch dataset class.
+- The transform list should be list of torchvision [transformations](https://pytorch.org/vision/0.8/transforms.html)
+- Filament ratio is tuple variable that takes (L,R,U).
+### Initializing Filament dataset
+To initialize filament dataset class follow parameters are required:
+- bbso_path - BBSO full disk H-alpha solar images comes with petdata, path of the folder.
+- ann_file - a H-alpha based manually labelled filaments in a json file comes with petdata.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+```python
+bbso_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'petdata', '2015'))
+dataset = FilamentDataset(bbso_path = bbso_path, ann_file = bbso_json,
+ start_time = "2015-08-01 17:36:15", end_time = "2015-08-09 17:36:15")
+```
+ loading annotations into memory...
+ Done (t=0.07s)
+ creating index...
+ index created!
+### Setup transformations for data augmentation
+The transformations function can be refered from [torchvision transforms](https://pytorch.org/vision/0.8/transforms.html)
+- Here transforms variable should have list of torchvision transforms functions as shown below:
+```python
+transforms1 = [
+ transforms.ColorJitter(brightness=(0.25,1.25), contrast=(0.25,2.00), saturation=(0.25,2.25)),
+ transforms.RandomRotation(15,expand=False,fill=110)
+]
+```
+### Initializing data loader
+- dataset = object of filament dataset class.
+- batch_size = number of filaments to be generated per batch.
+- filament_ratio = tuple of three values, i.e., ratios of left, right and unidentified chirality to be generated in each batch.
+- n_batchs = number of batchs.
+- transforms = list of torchvision transformations functions
+- image_dim = image dimensions if image dimension is -1 then image will not be resize, i.e., output is original image size.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),n_batchs = 10,
+ transforms = transforms1, image_dim = 224)
+```
+#### How to generate 3 filament images for every batch with ratio of left as 1, right chirality as 1 and unidentified as 1 for 10 batches with original image dimension and display the images?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),
+ n_batchs = 10, transforms = transforms1, image_dim = -1)
+```
+#### Batch -1 augmented filament images and their following labels (1=R, 0= U, -1=L)
+```python
+for original_imgs, transformed_imgs, labels in data_loader:
+ for org_img, img, label in zip(original_imgs ,transformed_imgs, labels):
+ print("Original image")
+ plt.imshow(org_img, cmap='gray')
+ plt.show()
+ print("Transformed image")
+ plt.imshow(img, cmap='gray')
+ plt.show()
+ print("Label",label)
+ break
+```
+ Original image
+![png](document_images/output_18_1.png)
+ Transformed image
+![png](document_images/output_18_3.png)
+ Label 0
+ Original image
+![png](document_images/output_18_5.png)
+ Transformed image
+![png](document_images/output_18_7.png)
+ Label 1
+ Original image
+![png](document_images/output_18_9.png)
+ Transformed image
+![png](document_images/output_18_11.png)
+ Label -1
+#### How to generate 12 filament images for every batch with ratio of left as 2, right chirality as 3 and unidentified as 1 for 5 batches with image dimension of 224x224 ?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 12 , filament_ratio = (2, 3, 1),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+#### How to generate 10 filament images for every batch only for left and right chirality for 5 batches with image dimension of 224x224 ?
+- In order to remove one type of chiraity, filament ratio, i.e., tuple(L, R, U):
+ - if L=0 that means left chirality is eliminated. Similarly, this applies to other types as well.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 10 , filament_ratio = (1, 1, 0),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [-1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+
+%package help
+Summary: Development documents and examples for augmentation-engine
+Provides: python3-augmentation-engine-doc
+%description help
+```python
+pip install augmentation_engine
+```
+ Requirement already satisfied: augmentation_engine in d:\gsu_assignments\semester_2\dl\augmentation_engine (0.0.1)
+ Requirement already satisfied: sortedcontainers in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (2.4.0)
+ Requirement already satisfied: opencv_python in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (4.5.3.56)
+ Requirement already satisfied: torchvision in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (0.10.0)
+ Requirement already satisfied: pillow in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from augmentation_engine) (8.3.2)
+ Requirement already satisfied: numpy>=1.17.3 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from opencv_python->augmentation_engine) (1.21.2)
+ Requirement already satisfied: torch==1.9.0 in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torchvision->augmentation_engine) (1.9.0)
+ Requirement already satisfied: typing-extensions in c:\users\shreejaa talla\pycharmprojects\bbso_fa\venv\lib\site-packages (from torch==1.9.0->torchvision->augmentation_engine) (3.10.0.2)
+ Note: you may need to restart the kernel to use updated packages.
+### Import Required Libraries
+```python
+import os
+from torchvision import transforms
+import matplotlib.pyplot as plt
+from filament_augmentation.loader.filament_dataloader import FilamentDataLoader
+from filament_augmentation.generator.filament_dataset import FilamentDataset
+from filament_augmentation.metadata.filament_metadata import FilamentMetadata
+```
+**To find out the number of left, right and unidentified chiralities for an interval of time.**
+- The code snippet below gives the *chirality distribution*, i.e., the distribution of left, right and unidentified chiralities for an interval of time from "2015-08-01 17:36:15" to "2015-08-09 18:15:17".
+- Here the petdata has big bear space observatory(BBSO) full disk solar images from (01-09) aug 2015.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+- The ann_file or annotation file is a H-alpha based manually labelled filaments in a json file comes with petdata.
+```python
+__file__ = 'augmentation_process.ipynb'
+bbso_json = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), 'petdata', 'bbso_json_data','2015_chir_data.json'))
+filamentInfo = FilamentMetadata(ann_file = bbso_json, start_time = '2015-08-01 00:00:15',
+ end_time = '2015-08-30 23:59:59')
+filamentInfo.get_chirality_distribution()
+```
+ (22, 30, 186)
+- In order to generate extra filaments for left, right or unidentified chirality by either balancing the data or getting them in required ratios to train them using an ML algorithm. A filament dataset class should be initialized which is quite similar to that of pytorch dataset class.
+- The transform list should be list of torchvision [transformations](https://pytorch.org/vision/0.8/transforms.html)
+- Filament ratio is tuple variable that takes (L,R,U).
+### Initializing Filament dataset
+To initialize filament dataset class follow parameters are required:
+- bbso_path - BBSO full disk H-alpha solar images comes with petdata, path of the folder.
+- ann_file - a H-alpha based manually labelled filaments in a json file comes with petdata.
+- The format for start and end time should be YYYY-MM-DD HH:MM:SS.
+```python
+bbso_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'petdata', '2015'))
+dataset = FilamentDataset(bbso_path = bbso_path, ann_file = bbso_json,
+ start_time = "2015-08-01 17:36:15", end_time = "2015-08-09 17:36:15")
+```
+ loading annotations into memory...
+ Done (t=0.07s)
+ creating index...
+ index created!
+### Setup transformations for data augmentation
+The transformations function can be refered from [torchvision transforms](https://pytorch.org/vision/0.8/transforms.html)
+- Here transforms variable should have list of torchvision transforms functions as shown below:
+```python
+transforms1 = [
+ transforms.ColorJitter(brightness=(0.25,1.25), contrast=(0.25,2.00), saturation=(0.25,2.25)),
+ transforms.RandomRotation(15,expand=False,fill=110)
+]
+```
+### Initializing data loader
+- dataset = object of filament dataset class.
+- batch_size = number of filaments to be generated per batch.
+- filament_ratio = tuple of three values, i.e., ratios of left, right and unidentified chirality to be generated in each batch.
+- n_batchs = number of batchs.
+- transforms = list of torchvision transformations functions
+- image_dim = image dimensions if image dimension is -1 then image will not be resize, i.e., output is original image size.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),n_batchs = 10,
+ transforms = transforms1, image_dim = 224)
+```
+#### How to generate 3 filament images for every batch with ratio of left as 1, right chirality as 1 and unidentified as 1 for 10 batches with original image dimension and display the images?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 3 , filament_ratio = (1, 1, 1),
+ n_batchs = 10, transforms = transforms1, image_dim = -1)
+```
+#### Batch -1 augmented filament images and their following labels (1=R, 0= U, -1=L)
+```python
+for original_imgs, transformed_imgs, labels in data_loader:
+ for org_img, img, label in zip(original_imgs ,transformed_imgs, labels):
+ print("Original image")
+ plt.imshow(org_img, cmap='gray')
+ plt.show()
+ print("Transformed image")
+ plt.imshow(img, cmap='gray')
+ plt.show()
+ print("Label",label)
+ break
+```
+ Original image
+![png](document_images/output_18_1.png)
+ Transformed image
+![png](document_images/output_18_3.png)
+ Label 0
+ Original image
+![png](document_images/output_18_5.png)
+ Transformed image
+![png](document_images/output_18_7.png)
+ Label 1
+ Original image
+![png](document_images/output_18_9.png)
+ Transformed image
+![png](document_images/output_18_11.png)
+ Label -1
+#### How to generate 12 filament images for every batch with ratio of left as 2, right chirality as 3 and unidentified as 1 for 5 batches with image dimension of 224x224 ?
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 12 , filament_ratio = (2, 3, 1),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 0]])
+ size of images torch.Size([12, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 0],
+ [ 1],
+ [ 0],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+#### How to generate 10 filament images for every batch only for left and right chirality for 5 batches with image dimension of 224x224 ?
+- In order to remove one type of chiraity, filament ratio, i.e., tuple(L, R, U):
+ - if L=0 that means left chirality is eliminated. Similarly, this applies to other types as well.
+```python
+data_loader = FilamentDataLoader(dataset = dataset,batch_size = 10 , filament_ratio = (1, 1, 0),
+ n_batchs = 5, transforms = transforms1, image_dim = 224)
+```
+```python
+for _, imgs, labels in data_loader:
+ print("size of images ",imgs.shape)
+ print("labels for each batch ",labels)
+```
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [-1],
+ [-1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[ 1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+ size of images torch.Size([10, 224, 224])
+ labels for each batch tensor([[-1],
+ [-1],
+ [-1],
+ [ 1],
+ [ 1],
+ [ 1],
+ [-1],
+ [ 1],
+ [-1],
+ [ 1]])
+
+%prep
+%autosetup -n augmentation-engine-0.1.2
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-augmentation-engine -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.2-1
+- Package Spec generated