Myosotis-Researches 0.1.23__py3-none-any.whl → 0.1.24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,3 @@ from ..old.SimpleProgressBar import SimpleProgressBar
2
2
  from ..old.IMGs_dataset import IMGs_dataset
3
3
  from ..old.train import PlotLoss, compute_entropy, predict_class_labels, DiffAugment
4
4
  from ..old.opts import parse_opts
5
-
6
- __all__ = [
7
- "SimpleProgressBar",
8
- "IMGs_dataset",
9
- "PlotLoss",
10
- "compute_entropy",
11
- "predict_class_labels",
12
- "DiffAugment",
13
- "parse_opts",
14
- ]
@@ -1,4 +1,2 @@
1
1
  from .concat_image import concat_image
2
2
  from .view_dataset import view_dataset
3
-
4
- __all__ = ["concat_image", "view_dataset"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: A repository for storing my progress of researches.
5
5
  Home-page: https://github.com/Zeyu-Xie/Myosotis-Researches
6
6
  Author: Zeyu Xie
@@ -1,9 +1,5 @@
1
1
  myosotis_researches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  myosotis_researches/CcGAN/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- myosotis_researches/CcGAN/internal/__init__.py,sha256=b-63yANNRQXgLF9k9yGdrm7mlULqGic1HTQTzg9wIME,209
4
- myosotis_researches/CcGAN/internal/install_datasets.py,sha256=F0Wq-lziRTPZs9oH-AOwtxfve2mwQ3Sx-BwHhLY93ak,1197
5
- myosotis_researches/CcGAN/internal/show_datasets.py,sha256=BWtQ6vdiEUOTrOs8aMBv6utuUN0IiaLKcK5iXq9y2qI,363
6
- myosotis_researches/CcGAN/internal/uninstall_datasets.py,sha256=7pxPZcSe9RHncF0I_4rf8ZdI7eQwv-sFVfxzSVZfYHQ,297
7
3
  myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py,sha256=uYDngtHoB7frPg2Vs7YCFXeUh7Y7MjaAXbRWHXO_xvw,10629
8
4
  myosotis_researches/CcGAN/models_128/ResNet_class_eval.py,sha256=wa5CPkYzrS0X6kZ6pGHM-GxcGNkSpBdTTqgy5dKVKkU,5131
9
5
  myosotis_researches/CcGAN/models_128/ResNet_embed.py,sha256=HKSY-5WWa9jGniOgRoR1WOTfWhR1Dcj6cq2sgznZEbE,6344
@@ -22,7 +18,7 @@ myosotis_researches/CcGAN/models_256/cGAN_SAGAN.py,sha256=wTHVkUcAp07n3lgweKFo6c
22
18
  myosotis_researches/CcGAN/models_256/cGAN_concat_SAGAN.py,sha256=ZmGEpprDDlFR3dG32LT3NH5yiA1WR8Hg26rcbz42aCQ,9807
23
19
  myosotis_researches/CcGAN/old/IMGs_dataset.py,sha256=i45PBNSCeAEB5uUG0SluYRTuHWZwH_5ldz2wm6afkYs,927
24
20
  myosotis_researches/CcGAN/old/SimpleProgressBar.py,sha256=S4eD_m6ysHRMHAmRtkTXVRNfXTR8kuHv-d3lUN0BVn4,546
25
- myosotis_researches/CcGAN/old/__init__.py,sha256=EF9rJntPdduRXJcIYz0n25FZzP6cxDVAEQ82XgfZi5Q,381
21
+ myosotis_researches/CcGAN/old/__init__.py,sha256=e_hqBiqDN58CiHFW4uoqCPWdmztmBItEDttypffi0MA,217
26
22
  myosotis_researches/CcGAN/old/opts.py,sha256=pd7-wknNPBO5hWRpO3YAPmmAsPKgZUUpKc4gWMs6Wto,5397
27
23
  myosotis_researches/CcGAN/old/train.py,sha256=5ZXgkGesuInqUooJRpLej_KHqYQtlSDq90_5wig5elQ,5152
28
24
  myosotis_researches/CcGAN/train/__init__.py,sha256=-55Ccov89II6Yuaiszi8ziw9EoVQr7OJR0bQfPAE_10,127
@@ -30,17 +26,11 @@ myosotis_researches/CcGAN/train/train_ccgan.py,sha256=0Qxibgd2-WaYgbyYeeOyiMkdcw
30
26
  myosotis_researches/CcGAN/train/train_cgan.py,sha256=sxMzvlmdjmqufwJFxBwatcoJecYqn2Uidedu15CL9ws,9619
31
27
  myosotis_researches/CcGAN/train/train_cgan_concat.py,sha256=OrQbwdU_ujUeKFGixUUpnini6rURtbuHv9NDrP6g0X0,8861
32
28
  myosotis_researches/CcGAN/train/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
33
- myosotis_researches/CcGAN/utils/__init__.py,sha256=SQNJMi-Ru_bxKp1OxQ9_FVV6G4dy9ZdKaX1selUyFks,122
29
+ myosotis_researches/CcGAN/utils/__init__.py,sha256=q13-OwYs-mkVz3qdJ2tNFktlulHNXx0BR13bY0rN1V0,78
34
30
  myosotis_researches/CcGAN/utils/concat_image.py,sha256=BIGKz52Inn9S7M5fBFKye2V9bLJ0DqEQILoOVWAXUiE,2165
35
31
  myosotis_researches/CcGAN/utils/view_dataset.py,sha256=BaAKII7BAItVhL--H5q88H9cUR7nSDTtAvV_uz6b6hs,415
36
- myosotis_researches/CcGAN/visualize/__init__.py,sha256=RHfzFo7FgcJhZVQ9DkEIGELK-lQNC5X915kPH8XGSiM,85
37
- myosotis_researches/CcGAN/visualize/visualize_datasets.py,sha256=TVyKFxyJCQl0ele_M1zp8kGP2eyXWyGnb1i2fu16ixg,2604
38
- myosotis_researches/CcGAN/visualize/src/style.css,sha256=4XFbetMeTKBZcG2EJH2sq4EIuvfSO_AyiVeM63ixvSI,584
39
- myosotis_researches/CcGAN/visualize/src/style.css.map,sha256=GTGPet_xXnKQnsz-E2CMUWtrgu3D5t0g4J_A_amFdvw,246
40
- myosotis_researches/CcGAN/visualize/src/style.scss,sha256=qk50CR-6wZ3lUHV5QvRWTUyqgCqOcKVEndi2Miv3Yig,533
41
- myosotis_researches/CcGAN/visualize/src/template.html,sha256=5b_gnguXoXw9ugaLPXQFpiv0bix4wFELABx4pzV6_ac,2371
42
- myosotis_researches-0.1.23.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
43
- myosotis_researches-0.1.23.dist-info/METADATA,sha256=376SjnIVMSjfUCVhvonksqMrWN6R9vDjdZnWNW7HpEM,3484
44
- myosotis_researches-0.1.23.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
45
- myosotis_researches-0.1.23.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
46
- myosotis_researches-0.1.23.dist-info/RECORD,,
32
+ myosotis_researches-0.1.24.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
+ myosotis_researches-0.1.24.dist-info/METADATA,sha256=s83HKvH4e0B4DbBXF1sUe6wHEg8N3PZbFmf5h4xaP6o,3484
34
+ myosotis_researches-0.1.24.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
35
+ myosotis_researches-0.1.24.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
36
+ myosotis_researches-0.1.24.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- from .install_datasets import install_datasets
2
- from .uninstall_datasets import uninstall_datasets
3
- from .show_datasets import show_datasets
4
-
5
- __all__ = ["install_datasets", "uninstall_datasets", "show_datasets"]
@@ -1,49 +0,0 @@
1
- import gdown
2
- import getpass
3
- from importlib import resources
4
- import os
5
- import subprocess
6
-
7
- # Paths
8
- datasets_dir = resources.files("myosotis_researches").joinpath("CcGAN", "datasets")
9
-
10
- # File ID dictionary
11
- file_id_dict = {
12
- "Ra": "1CcXp7ga4Ebj7XeMA_fYH2RxTMOWvA0v5",
13
- "MNIST": "1uAL7c8GNgv6VL42PGmc9Ei-MTNGOPUO4",
14
- "Ra_sorted": "1pQ_HVkkBB7tpnaxDuStoyw_SSOS-Qqkb"
15
- }
16
-
17
-
18
- # Function
19
- def install_datasets(datasets_name):
20
-
21
- # Makedir
22
- if not os.path.exists(datasets_dir):
23
- os.makedirs(datasets_dir, exist_ok=True)
24
-
25
- # Path
26
- zipped_dataset_path = os.path.join(datasets_dir, f"{datasets_name}_datasets.rar")
27
-
28
- # File ID
29
- file_id = file_id_dict[datasets_name]
30
-
31
- # URL
32
- url = f"https://drive.google.com/uc?id={file_id}"
33
-
34
- # Download
35
- gdown.download(url, zipped_dataset_path, quiet=False, use_cookies=False)
36
-
37
- # Unzip
38
- unzip_password = getpass.getpass("Password:")
39
- cmd = ["unrar", "x", f"-p{unzip_password}", zipped_dataset_path, datasets_dir]
40
- try:
41
- subprocess.run(cmd, check=True)
42
- except subprocess.CalledProcessError as e:
43
- print(e)
44
-
45
- # Delete zipped datasets
46
- os.remove(zipped_dataset_path)
47
-
48
-
49
- __all__ = ["install_datasets"]
@@ -1,15 +0,0 @@
1
- from importlib import resources
2
- import os
3
-
4
- datasets_dir = resources.files("myosotis_researches").joinpath("CcGAN", "datasets")
5
-
6
-
7
- def show_datasets():
8
-
9
- if not os.path.exists(datasets_dir):
10
- os.makedirs(datasets_dir, exist_ok=True)
11
-
12
- datasets = []
13
- for item in os.listdir(datasets_dir):
14
- datasets.append(item)
15
- print("\n".join(datasets))
@@ -1,16 +0,0 @@
1
- from importlib import resources
2
- import os
3
- import shutil
4
-
5
-
6
- # Paths
7
- datasets_dir = resources.files("myosotis_researches").joinpath("CcGAN", "datasets")
8
-
9
-
10
- # Function
11
- def uninstall_datasets():
12
- if os.path.exists(datasets_dir):
13
- shutil.rmtree(datasets_dir)
14
-
15
-
16
- __all__ = ["uninstall_datasets"]
@@ -1,3 +0,0 @@
1
- from .visualize_datasets import visualize_datasets
2
-
3
- __all__ = ["visualize_datasets"]
@@ -1,44 +0,0 @@
1
- * {
2
- font-family: Arial, Helvetica, sans-serif;
3
- scrollbar-width: none;
4
- -ms-overflow-style: none;
5
- }
6
- * ::-webkit-scrollbar {
7
- display: none;
8
- }
9
-
10
- body {
11
- margin: 0 1rem;
12
- border: 0;
13
- padding: 0;
14
- }
15
-
16
- .code {
17
- font-family: "Courier New", Courier, monospace;
18
- }
19
-
20
- .container {
21
- margin: 0;
22
- border: 0;
23
- padding: 0;
24
- overflow: scroll;
25
- }
26
-
27
- .inline-info {
28
- word-break: break-all;
29
- }
30
-
31
- #main-container {
32
- margin: 1rem auto;
33
- }
34
-
35
- #main-table {
36
- margin-inline: auto;
37
- text-align: center;
38
- }
39
- #main-table th,
40
- #main-table td {
41
- padding: 0.5rem 1rem;
42
- }
43
-
44
- /*# sourceMappingURL=style.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sourceRoot":"","sources":["style.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;AACA;AAAA;EAEE","file":"style.css"}
@@ -1,42 +0,0 @@
1
- * {
2
- font-family: Arial, Helvetica, sans-serif;
3
- scrollbar-width: none;
4
- -ms-overflow-style: none;
5
- ::-webkit-scrollbar {
6
- display: none;
7
- }
8
- }
9
-
10
- body {
11
- margin: 0 1rem;
12
- border: 0;
13
- padding: 0;
14
- }
15
-
16
- .code {
17
- font-family: "Courier New", Courier, monospace;
18
- }
19
-
20
- .container {
21
- margin: 0;
22
- border: 0;
23
- padding: 0;
24
- overflow: scroll;
25
- }
26
-
27
- .inline-info {
28
- word-break: break-all;
29
- }
30
-
31
- #main-container {
32
- margin: 1rem auto;
33
- }
34
-
35
- #main-table {
36
- margin-inline: auto;
37
- text-align: center;
38
- th,
39
- td {
40
- padding: 0.5rem 1rem;
41
- }
42
- }
@@ -1,75 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Dataset Visualize</title>
8
- <link rel="stylesheet" href="./style.css">
9
- </head>
10
-
11
- <body>
12
-
13
- <div class="container" id="main-container">
14
- <h1>Dataset Visualize</h1>
15
- <hr>
16
- <section>
17
- <h2>Dataset Info</h2>
18
- <div class="container" id="dataset-info-container">
19
- <p><b>Datasets Path</b></p>
20
- <p class="code inline-info">{{ datasets_path }}</p>
21
- <p><b>List Path</b></p>
22
- <p class="code inline-info">{{ list_path }}</p>
23
- <p><b>Template Path</b></p>
24
- <p class="code inline-info">{{ template_path }}</p>
25
- </div>
26
- </section>
27
- <hr>
28
- <section>
29
- <h2>Data List</h2>
30
- <p><b>Indexes</b></p>
31
- <p class="code">{{ indexes }}</p>
32
- <p><b>List</b></p>
33
- <div class="container">
34
- <table id="main-table">
35
- <thead>
36
- <tr>
37
- <th>Index</th>
38
- <th>Image</th>
39
- <th>Image Name</th>
40
- <th>Label</th>
41
- <th>Type</th>
42
- <th>Original Index</th>
43
- </tr>
44
- </thead>
45
- {% for item in items %}
46
- <tr>
47
- <td>
48
- {{ loop.index }}
49
- </td>
50
- <td>
51
- <img src="{{ item.image }}" alt="" style="width: {{ img_size }}px;">
52
- </td>
53
- <td class="code">
54
- {{ item.image_name }}
55
- </td>
56
- <td>
57
- {{ item.label }}
58
- </td>
59
- <td>
60
- {{ item.type }}
61
- </td>
62
- <td>
63
- {{ item.index }}
64
- </td>
65
- </tr>
66
- {% endfor %}
67
- </table>
68
- </div>
69
- </section>
70
- </div>
71
-
72
-
73
- </body>
74
-
75
- </html>
@@ -1,103 +0,0 @@
1
- import base64
2
- from flask import Flask, send_file
3
- import h5py
4
- from importlib import resources
5
- from io import BytesIO
6
- from jinja2 import Template
7
- from myosotis_researches.CcGAN.internal import *
8
- import numpy as np
9
- import pandas as pd
10
- from PIL import Image
11
-
12
-
13
- def Image_to_Base64(image: Image):
14
- buffered = BytesIO()
15
- image.save(buffered, format="PNG")
16
- img_base64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
17
- return f"data:image/png;base64,{img_base64}"
18
-
19
-
20
- def datasets_to_html(indexes, datasets_path, list_path, template_path, img_size):
21
-
22
- N = len(indexes)
23
-
24
- # Get template
25
- with open(template_path, "r") as f:
26
- template = Template(f.read())
27
-
28
- # Get data
29
- with h5py.File(datasets_path, "r") as f:
30
- images = f["images"][:]
31
- index_train = f["index_train"][:]
32
- index_valid = f["index_valid"][:]
33
- labels = f["labels"][:]
34
- types = f["types"][:]
35
- images = images[indexes]
36
- labels = labels[indexes]
37
- types = types[indexes]
38
-
39
- # Get list
40
- df = pd.read_csv(list_path)
41
- image_names = df.iloc[indexes]["image_name"]
42
-
43
- # Transform data to base64
44
- images = np.transpose(images, (0, 2, 3, 1))
45
- images = [Image.fromarray(image) for image in images]
46
- images_base64 = [Image_to_Base64(image) for image in images]
47
-
48
- # Render template
49
- items = []
50
- for i in range(N):
51
- items.append(
52
- {
53
- "image": images_base64[i],
54
- "image_name": image_names.iloc[i],
55
- "label": labels[i],
56
- "type": types[i],
57
- "index": indexes[i],
58
- }
59
- )
60
-
61
- return template.render(
62
- indexes=indexes,
63
- datasets_path=datasets_path,
64
- list_path=list_path,
65
- template_path=template_path,
66
- items=items,
67
- img_size=img_size,
68
- )
69
-
70
-
71
- def visualize_datasets(
72
- indexes,
73
- datasets_path,
74
- list_path,
75
- template_path=resources.files("myosotis_researches").joinpath(
76
- "CcGAN", "visualize", "src", "template.html"
77
- ),
78
- host="127.0.0.1",
79
- port=8000,
80
- debug=True,
81
- img_size=64,
82
- ):
83
- # Local server
84
- app = Flask(__name__)
85
-
86
- @app.route("/")
87
- def index():
88
- return datasets_to_html(
89
- indexes, datasets_path, list_path, template_path, img_size
90
- )
91
-
92
- @app.route("/style.css")
93
- def style():
94
- return send_file(
95
- resources.files("myosotis_researches").joinpath(
96
- "CcGAN", "visualize", "src", "style.css"
97
- )
98
- )
99
-
100
- app.run(host=host, port=port, debug=debug)
101
-
102
-
103
- __all__ = ["visualize_datasets"]