Myosotis-Researches 0.1.10__py3-none-any.whl → 0.1.12__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/visualize/__init__.py +3 -0
- myosotis_researches/CcGAN/visualize/src/style.css +47 -0
- myosotis_researches/CcGAN/visualize/src/style.css.map +1 -0
- myosotis_researches/CcGAN/visualize/src/style.scss +40 -0
- myosotis_researches/CcGAN/visualize/src/template.html +60 -0
- myosotis_researches/CcGAN/visualize/visualize_datasets.py +98 -0
- {myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/METADATA +1 -1
- {myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/RECORD +11 -5
- {myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/WHEEL +0 -0
- {myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/licenses/LICENSE +0 -0
- {myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,47 @@
|
|
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
|
+
width: 100vw;
|
12
|
+
max-width: 1024px;
|
13
|
+
margin: 0 auto;
|
14
|
+
}
|
15
|
+
|
16
|
+
.container {
|
17
|
+
margin: 0;
|
18
|
+
border: 0;
|
19
|
+
padding: 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
.code {
|
23
|
+
font-family: "Courier New", Courier, monospace;
|
24
|
+
}
|
25
|
+
|
26
|
+
#header-container {
|
27
|
+
margin: 1rem auto;
|
28
|
+
overflow: hidden;
|
29
|
+
}
|
30
|
+
#header-container p {
|
31
|
+
overflow: scroll;
|
32
|
+
white-space: nowrap;
|
33
|
+
}
|
34
|
+
|
35
|
+
#main-container {
|
36
|
+
margin: 1rem auto;
|
37
|
+
width: fit-content;
|
38
|
+
}
|
39
|
+
|
40
|
+
#main-table {
|
41
|
+
text-align: center;
|
42
|
+
}
|
43
|
+
#main-table th, #main-table td {
|
44
|
+
padding: 0.5rem 1rem;
|
45
|
+
}
|
46
|
+
|
47
|
+
/*# 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;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;AACA;EACE;EACA;;;AAGJ;EACE;EACA;;;AAEF;EACE;;AACA;EACE","file":"style.css"}
|
@@ -0,0 +1,40 @@
|
|
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
|
+
width: 100vw;
|
12
|
+
max-width: 1024px;
|
13
|
+
margin: 0 auto;
|
14
|
+
}
|
15
|
+
.container {
|
16
|
+
margin: 0;
|
17
|
+
border: 0;
|
18
|
+
padding: 0;
|
19
|
+
}
|
20
|
+
.code {
|
21
|
+
font-family: "Courier New", Courier, monospace;
|
22
|
+
}
|
23
|
+
#header-container {
|
24
|
+
margin: 1rem auto;
|
25
|
+
overflow: hidden;
|
26
|
+
p {
|
27
|
+
overflow: scroll;
|
28
|
+
white-space: nowrap;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
#main-container {
|
32
|
+
margin: 1rem auto;
|
33
|
+
width: fit-content;
|
34
|
+
}
|
35
|
+
#main-table {
|
36
|
+
text-align: center;
|
37
|
+
th, td {
|
38
|
+
padding: 0.5rem 1rem;
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,60 @@
|
|
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>Document</title>
|
8
|
+
<link rel="stylesheet" href="./style.css">
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<header>
|
13
|
+
<div class="container" id="header-container">
|
14
|
+
<p><b>Datasets Path</b></p>
|
15
|
+
<p class="code">{{ datasets_path }}</p>
|
16
|
+
<p><b>List Path</b></p>
|
17
|
+
<p class="code">{{ list_path }}</p>
|
18
|
+
<p><b>Template Path</b></p>
|
19
|
+
<p class="code">{{ template_path }}</p>
|
20
|
+
<p><b>Indexes</b></p>
|
21
|
+
<p class="code">{{ indexes }}</p>
|
22
|
+
</div>
|
23
|
+
</header>
|
24
|
+
<hr>
|
25
|
+
<h2>All Datas</h2>
|
26
|
+
<div class="container" id="main-container">
|
27
|
+
<table id="main-table">
|
28
|
+
<thead>
|
29
|
+
<tr>
|
30
|
+
<th>Image</th>
|
31
|
+
<th>Image Name</th>
|
32
|
+
<th>Label</th>
|
33
|
+
<th>Type</th>
|
34
|
+
<th>Original Index</th>
|
35
|
+
</tr>
|
36
|
+
</thead>
|
37
|
+
{% for item in items %}
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
<img src="{{ item.image }}" alt="" style="width: 64px;">
|
41
|
+
</td>
|
42
|
+
<td class="code">
|
43
|
+
{{ item.image_name }}
|
44
|
+
</td>
|
45
|
+
<td>
|
46
|
+
{{ item.label }}
|
47
|
+
</td>
|
48
|
+
<td>
|
49
|
+
{{ item.type }}
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
{{ item.index }}
|
53
|
+
</td>
|
54
|
+
</tr>
|
55
|
+
{% endfor %}
|
56
|
+
</table>
|
57
|
+
</div>
|
58
|
+
</body>
|
59
|
+
|
60
|
+
</html>
|
@@ -0,0 +1,98 @@
|
|
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):
|
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"][indexes]
|
31
|
+
index_train = f["index_train"][:]
|
32
|
+
index_valid = f["index_valid"][:]
|
33
|
+
labels = f["labels"][indexes]
|
34
|
+
types = f["types"][indexes]
|
35
|
+
|
36
|
+
# Get list
|
37
|
+
df = pd.read_csv(list_path)
|
38
|
+
tool_wears = df.loc[indexes, "tool_wear"]
|
39
|
+
surfaces = df.loc[indexes, "surface"]
|
40
|
+
image_names = df.loc[indexes, "image_name"]
|
41
|
+
|
42
|
+
# Transform data to base64
|
43
|
+
images = np.transpose(images, (0, 2, 3, 1))
|
44
|
+
images = [Image.fromarray(image) for image in images]
|
45
|
+
images_base64 = [Image_to_Base64(image) for image in images]
|
46
|
+
|
47
|
+
# Render template
|
48
|
+
items = []
|
49
|
+
for i in range(N):
|
50
|
+
items.append(
|
51
|
+
{
|
52
|
+
"image": images_base64[i],
|
53
|
+
"image_name": image_names[i],
|
54
|
+
"label": labels[i],
|
55
|
+
"type": types[i],
|
56
|
+
"index": indexes[i],
|
57
|
+
}
|
58
|
+
)
|
59
|
+
|
60
|
+
return template.render(
|
61
|
+
indexes=indexes,
|
62
|
+
datasets_path=datasets_path,
|
63
|
+
list_path=list_path,
|
64
|
+
template_path=template_path,
|
65
|
+
items=items,
|
66
|
+
)
|
67
|
+
|
68
|
+
|
69
|
+
def visualize_datasets(
|
70
|
+
indexes,
|
71
|
+
datasets_path,
|
72
|
+
list_path,
|
73
|
+
template_path=resources.files("myosotis_researches").joinpath(
|
74
|
+
"CcGAN", "visualize", "src", "template.html"
|
75
|
+
),
|
76
|
+
host="127.0.0.1",
|
77
|
+
port=8000,
|
78
|
+
debug=True,
|
79
|
+
):
|
80
|
+
# Local server
|
81
|
+
app = Flask(__name__)
|
82
|
+
|
83
|
+
@app.route("/")
|
84
|
+
def index():
|
85
|
+
return datasets_to_html(indexes, datasets_path, list_path, template_path)
|
86
|
+
|
87
|
+
@app.route("/style.css")
|
88
|
+
def style():
|
89
|
+
return send_file(
|
90
|
+
resources.files("myosotis_researches").joinpath(
|
91
|
+
"CcGAN", "visualize", "src", "style.css"
|
92
|
+
)
|
93
|
+
)
|
94
|
+
|
95
|
+
app.run(host=host, port=port, debug=debug)
|
96
|
+
|
97
|
+
|
98
|
+
__all__ = ["visualize_datasets"]
|
@@ -33,8 +33,14 @@ myosotis_researches/CcGAN/utils/make_h5.py,sha256=VtFYjr_i-JktsEW_BvofpilcDmChRm
|
|
33
33
|
myosotis_researches/CcGAN/utils/opts.py,sha256=pd7-wknNPBO5hWRpO3YAPmmAsPKgZUUpKc4gWMs6Wto,5397
|
34
34
|
myosotis_researches/CcGAN/utils/print_hdf5.py,sha256=VvmNAWtMDmg6D9V6ZbSUXrQTKRh9WIJeC4BR_ORJkco,300
|
35
35
|
myosotis_researches/CcGAN/utils/train.py,sha256=5ZXgkGesuInqUooJRpLej_KHqYQtlSDq90_5wig5elQ,5152
|
36
|
-
myosotis_researches
|
37
|
-
myosotis_researches
|
38
|
-
myosotis_researches
|
39
|
-
myosotis_researches
|
40
|
-
myosotis_researches
|
36
|
+
myosotis_researches/CcGAN/visualize/__init__.py,sha256=RHfzFo7FgcJhZVQ9DkEIGELK-lQNC5X915kPH8XGSiM,85
|
37
|
+
myosotis_researches/CcGAN/visualize/visualize_datasets.py,sha256=NcrszJon9mFtffMyIR8SJyxl-ZXWWEutFcViXzpn5e0,2533
|
38
|
+
myosotis_researches/CcGAN/visualize/src/style.css,sha256=tn4ht9S6r0erf6zo5zfmOKPGjJ1TCLYBTI-YMbuDjFQ,661
|
39
|
+
myosotis_researches/CcGAN/visualize/src/style.css.map,sha256=QUV9UJNpjbfsAYBpnWPzOzInHPFmepgKkAuK_G_a2Xk,257
|
40
|
+
myosotis_researches/CcGAN/visualize/src/style.scss,sha256=tyMXl4ouQ1zuZ6JmSxFFJBVzaUgpC3eyhXsbVRcnD9A,593
|
41
|
+
myosotis_researches/CcGAN/visualize/src/template.html,sha256=_U3t5DfyvN2gdtWt5ggIiSpbhOXumOL52H42Envb8o8,1655
|
42
|
+
myosotis_researches-0.1.12.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
43
|
+
myosotis_researches-0.1.12.dist-info/METADATA,sha256=TvrRWPvJNQQSZMKzkTSECE9Mk86OCBC9Ym9Vl9kCZIg,2664
|
44
|
+
myosotis_researches-0.1.12.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
45
|
+
myosotis_researches-0.1.12.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
|
46
|
+
myosotis_researches-0.1.12.dist-info/RECORD,,
|
File without changes
|
{myosotis_researches-0.1.10.dist-info → myosotis_researches-0.1.12.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|