Myosotis-Researches 0.1.26__py3-none-any.whl → 0.1.27__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.
- myosotis_researches/CcGAN/utils/dataset.py +91 -1
- myosotis_researches/CcGAN/utils/src/style.css +44 -0
- myosotis_researches/CcGAN/utils/src/style.css.map +1 -0
- myosotis_researches/CcGAN/utils/src/style.scss +42 -0
- myosotis_researches/CcGAN/utils/src/template.html +106 -0
- {myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/METADATA +1 -1
- {myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/RECORD +10 -6
- {myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/WHEEL +0 -0
- {myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/licenses/LICENSE +0 -0
- {myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,18 @@
|
|
1
|
+
import base64
|
2
|
+
from flask import Flask, send_file
|
1
3
|
import gdown
|
2
4
|
import getpass
|
3
5
|
import h5py
|
6
|
+
import h5py
|
7
|
+
import humanize
|
8
|
+
from importlib import resources
|
9
|
+
from io import BytesIO
|
10
|
+
from jinja2 import Template
|
11
|
+
import numpy as np
|
4
12
|
import os
|
13
|
+
from PIL import Image
|
5
14
|
import subprocess
|
15
|
+
import time
|
6
16
|
|
7
17
|
|
8
18
|
# view_dataset
|
@@ -19,6 +29,86 @@ def view_dataset(dataset_path):
|
|
19
29
|
f.visititems(_print_hdf5)
|
20
30
|
|
21
31
|
|
32
|
+
# visualize_dataset
|
33
|
+
def _nparray_to_Base64(nparray):
|
34
|
+
nparray = np.transpose(nparray, (1, 2, 0))
|
35
|
+
image = Image.fromarray(nparray)
|
36
|
+
buffered = BytesIO()
|
37
|
+
image.save(buffered, format="PNG")
|
38
|
+
image_base64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
39
|
+
return f"data:image/png;base64,{image_base64}"
|
40
|
+
|
41
|
+
|
42
|
+
def visualize_dataset(dataset_path, indexes):
|
43
|
+
keys = []
|
44
|
+
_data = {}
|
45
|
+
with h5py.File(dataset_path, "r") as f:
|
46
|
+
for key in f.keys():
|
47
|
+
keys.append(key)
|
48
|
+
_data[key] = f[key][:]
|
49
|
+
if _data[key].dtype.kind == "O":
|
50
|
+
_data[key] = _data[key].astype("str")
|
51
|
+
keys.append("original_indexes")
|
52
|
+
N = len(_data["images"])
|
53
|
+
data = []
|
54
|
+
for i in indexes:
|
55
|
+
item = {}
|
56
|
+
for key in keys:
|
57
|
+
if key == "images":
|
58
|
+
item[key] = _nparray_to_Base64(_data[key][i])
|
59
|
+
elif key in ["index_train", "index_valid"]:
|
60
|
+
continue
|
61
|
+
elif key == "original_indexes":
|
62
|
+
item[key] = i
|
63
|
+
else:
|
64
|
+
item[key] = _data[key][i]
|
65
|
+
data.append(item)
|
66
|
+
hyperinfo = {
|
67
|
+
"template_path": resources.files("myosotis_researches").joinpath(
|
68
|
+
"CcGAN", "utils", "src", "template.html"
|
69
|
+
),
|
70
|
+
"style_path": resources.files("myosotis_researches").joinpath(
|
71
|
+
"CcGAN", "utils", "src", "style.css"
|
72
|
+
),
|
73
|
+
"server_path": os.path.abspath(__file__),
|
74
|
+
"host": "0.0.0.0",
|
75
|
+
"port": "8000",
|
76
|
+
"debug": True,
|
77
|
+
}
|
78
|
+
info = {
|
79
|
+
"file": {
|
80
|
+
"size": humanize.naturalsize(os.path.getsize(dataset_path), binary=True),
|
81
|
+
"created_date": time.strftime(
|
82
|
+
"%Y-%m-%d %H:%M:%S", time.localtime(os.path.getctime(dataset_path))
|
83
|
+
),
|
84
|
+
"last_edited_date": time.strftime(
|
85
|
+
"%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(dataset_path))
|
86
|
+
),
|
87
|
+
"path": dataset_path,
|
88
|
+
"name": os.path.basename(dataset_path),
|
89
|
+
},
|
90
|
+
"rows": {"num": N},
|
91
|
+
"columns": {"num": len(keys), "list": keys},
|
92
|
+
"indexes": indexes,
|
93
|
+
}
|
94
|
+
all_data = data
|
95
|
+
|
96
|
+
# Local server
|
97
|
+
app = Flask(__name__)
|
98
|
+
|
99
|
+
@app.route("/")
|
100
|
+
def index():
|
101
|
+
with open(hyperinfo["template_path"], "r") as f:
|
102
|
+
template = Template(f.read())
|
103
|
+
return template.render(hyperinfo=hyperinfo, info=info, datas=all_data)
|
104
|
+
|
105
|
+
@app.route("/style.css")
|
106
|
+
def style():
|
107
|
+
return send_file(hyperinfo["style_path"])
|
108
|
+
|
109
|
+
app.run(host=hyperinfo["host"], port=hyperinfo["port"], debug=hyperinfo["debug"])
|
110
|
+
|
111
|
+
|
22
112
|
# download_datasets
|
23
113
|
_file_id_dict = {
|
24
114
|
"Ra": "1YVLFAaQ1ldre0ASLSRdV_kPIcAMkwGqO",
|
@@ -42,4 +132,4 @@ def download_datasets(datasets_name, datasets_dir):
|
|
42
132
|
os.remove(zipped_datasets_path)
|
43
133
|
|
44
134
|
|
45
|
-
__all__ = ["view_dataset", "download_datasets"]
|
135
|
+
__all__ = ["view_dataset", "visualize_dataset", "download_datasets"]
|
@@ -0,0 +1,44 @@
|
|
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
|
+
table {
|
36
|
+
text-align: center;
|
37
|
+
margin-inline: auto;
|
38
|
+
}
|
39
|
+
table th,
|
40
|
+
table td {
|
41
|
+
padding: 0.5rem 1rem;
|
42
|
+
}
|
43
|
+
|
44
|
+
/*# sourceMappingURL=style.css.map */
|
@@ -0,0 +1 @@
|
|
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"}
|
@@ -0,0 +1,42 @@
|
|
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
|
+
table {
|
36
|
+
text-align: center;
|
37
|
+
margin-inline: auto;
|
38
|
+
th,
|
39
|
+
td {
|
40
|
+
padding: 0.5rem 1rem;
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,106 @@
|
|
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 of {{ info.file.name }}</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 of <span class="code">{{ info.file.name }}</span></h1>
|
15
|
+
|
16
|
+
<hr>
|
17
|
+
|
18
|
+
<section>
|
19
|
+
<h2>Part 1. Hyperinfo</h2>
|
20
|
+
<div class="container" id="hyperinfo-container">
|
21
|
+
<p><b>Template Path</b></p>
|
22
|
+
<p class="code">{{ hyperinfo.template_path }}</p>
|
23
|
+
<p><b>Style Path</b></p>
|
24
|
+
<p class="code">{{ hyperinfo.style_path }}</p>
|
25
|
+
<p><b>Server Path</b></p>
|
26
|
+
<p class="code">{{ hyperinfo.server_path }}</p>
|
27
|
+
<table>
|
28
|
+
<tr>
|
29
|
+
<th>Host</th>
|
30
|
+
<th>Port</th>
|
31
|
+
<th>Debug</th>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td>{{ hyperinfo.host }}</td>
|
35
|
+
<td>{{ hyperinfo.port }}</td>
|
36
|
+
<td>{{ hyperinfo.debug }}</td>
|
37
|
+
</tr>
|
38
|
+
</table>
|
39
|
+
</div>
|
40
|
+
</section>
|
41
|
+
|
42
|
+
<section>
|
43
|
+
<h2>Part 2. Info</h2>
|
44
|
+
<div class="container" id="info-container">
|
45
|
+
<p><b>File Path</b></p>
|
46
|
+
<p class="code">{{ info.file.path }}</p>
|
47
|
+
<table>
|
48
|
+
<tr>
|
49
|
+
<th>File Size</th>
|
50
|
+
<th>Created Date</th>
|
51
|
+
<th>Last Edited Date</th>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td>{{ info.file.size }}</td>
|
55
|
+
<td>{{ info.file.created_date }}</td>
|
56
|
+
<td>{{ info.file.last_edited_date }}</td>
|
57
|
+
</tr>
|
58
|
+
</table>
|
59
|
+
<p><b>Number of Rows</b></p>
|
60
|
+
<p>{{ info.rows.num }}</p>
|
61
|
+
<p><b>Number of Columns</b></p>
|
62
|
+
<p>{{ info.columns.num }}</p>
|
63
|
+
<p><b>Columns List</b></p>
|
64
|
+
<p class="code">{{ info.columns.list }}</p>
|
65
|
+
<p><b>Indexes</b></p>
|
66
|
+
<p class="code">{{ info.indexes }}</p>
|
67
|
+
</div>
|
68
|
+
</section>
|
69
|
+
<section>
|
70
|
+
<h2>Part 3. Data List</h2>
|
71
|
+
<p><b>List</b></p>
|
72
|
+
<div class="container" id="data-list-container">
|
73
|
+
<table id="main-table">
|
74
|
+
<thead>
|
75
|
+
<tr>
|
76
|
+
<th>Images</th>
|
77
|
+
{% for key in info.columns.list %}
|
78
|
+
{% if key not in ["images", "index_train", "index_valid"] %}
|
79
|
+
<th>{{ key|capitalize }}</th>
|
80
|
+
{% endif %}
|
81
|
+
{% endfor %}
|
82
|
+
</tr>
|
83
|
+
</thead>
|
84
|
+
{% for data in datas %}
|
85
|
+
<tr>
|
86
|
+
<td>
|
87
|
+
<img src="{{ data.images }}" alt="" style="width: 64px;">
|
88
|
+
</td>
|
89
|
+
{% for key in info.columns.list %}
|
90
|
+
{% if key not in ["images", "index_train", "index_valid"] %}
|
91
|
+
<td {% if key == "image_names" %} class="code" {% endif %}>
|
92
|
+
{{ data[key] }}
|
93
|
+
</td>
|
94
|
+
{% endif %}
|
95
|
+
{% endfor %}
|
96
|
+
</tr>
|
97
|
+
{% endfor %}
|
98
|
+
</table>
|
99
|
+
</div>
|
100
|
+
</section>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
</body>
|
105
|
+
|
106
|
+
</html>
|
@@ -28,9 +28,13 @@ myosotis_researches/CcGAN/train/train_cgan_concat.py,sha256=OrQbwdU_ujUeKFGixUUp
|
|
28
28
|
myosotis_researches/CcGAN/train/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
|
29
29
|
myosotis_researches/CcGAN/utils/__init__.py,sha256=Y6HFAJRAOa4rMXhd1KIyr3NL_GzO0vjbp-dE4NT7QW8,92
|
30
30
|
myosotis_researches/CcGAN/utils/concat_image.py,sha256=BIGKz52Inn9S7M5fBFKye2V9bLJ0DqEQILoOVWAXUiE,2165
|
31
|
-
myosotis_researches/CcGAN/utils/dataset.py,sha256=
|
32
|
-
myosotis_researches
|
33
|
-
myosotis_researches
|
34
|
-
myosotis_researches
|
35
|
-
myosotis_researches
|
36
|
-
myosotis_researches-0.1.
|
31
|
+
myosotis_researches/CcGAN/utils/dataset.py,sha256=TXJSLMpwI1h0xb6lXpq5iUjjurheKPZnPbR2KIU-Py4,4216
|
32
|
+
myosotis_researches/CcGAN/utils/src/style.css,sha256=bNp3_nlpg0W5qA7Rx8MM5ayeprEbYH3_6AIDRTN8UhM,566
|
33
|
+
myosotis_researches/CcGAN/utils/src/style.css.map,sha256=GTGPet_xXnKQnsz-E2CMUWtrgu3D5t0g4J_A_amFdvw,246
|
34
|
+
myosotis_researches/CcGAN/utils/src/style.scss,sha256=_Wa7VPmFzCkEHtrzdG35tj89QNwPd-fpiT-YL4ohcMs,526
|
35
|
+
myosotis_researches/CcGAN/utils/src/template.html,sha256=dTUJRfUW-ukA4Dw6jrDeeufl37xCiGykn2mlx3eLufs,3795
|
36
|
+
myosotis_researches-0.1.27.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
37
|
+
myosotis_researches-0.1.27.dist-info/METADATA,sha256=W2dj1tjE3SaU15XWEMlhzTQvH8UTkykQAzuAZiB7hSM,3484
|
38
|
+
myosotis_researches-0.1.27.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
39
|
+
myosotis_researches-0.1.27.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
|
40
|
+
myosotis_researches-0.1.27.dist-info/RECORD,,
|
File without changes
|
{myosotis_researches-0.1.26.dist-info → myosotis_researches-0.1.27.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|