Myosotis-Researches 0.1.10__tar.gz → 0.1.11__tar.gz
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-0.1.11/MANIFEST.in +1 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11/Myosotis_Researches.egg-info}/PKG-INFO +1 -1
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/Myosotis_Researches.egg-info/SOURCES.txt +4 -1
- {myosotis_researches-0.1.10/Myosotis_Researches.egg-info → myosotis_researches-0.1.11}/PKG-INFO +1 -1
- myosotis_researches-0.1.11/myosotis_researches/CcGAN/visualize/__init__.py +3 -0
- myosotis_researches-0.1.11/myosotis_researches/CcGAN/visualize/visualize_datasets.py +98 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/setup.py +2 -1
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/LICENSE +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/Myosotis_Researches.egg-info/dependency_links.txt +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/Myosotis_Researches.egg-info/top_level.txt +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/README.md +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/internal/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/internal/install_datasets.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/internal/show_datasets.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/internal/uninstall_datasets.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/ResNet_class_eval.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/ResNet_embed.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/ResNet_regre_eval.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/autoencoder.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/cGAN_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_128/cGAN_concat_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/CcGAN_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/ResNet_class_eval.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/ResNet_embed.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/ResNet_regre_eval.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/autoencoder.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/cGAN_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/models_256/cGAN_concat_SAGAN.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/train/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/train/train_ccgan.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/train/train_cgan.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/train/train_cgan_concat.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/train/train_net_for_label_embed.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/IMGs_dataset.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/SimpleProgressBar.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/concat_image.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/make_h5.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/opts.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/print_hdf5.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/train.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/__init__.py +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/pyproject.toml +0 -0
- {myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/setup.cfg +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
include myosotis_researches/CcGAN/visualize/src/
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/Myosotis_Researches.egg-info/SOURCES.txt
RENAMED
@@ -1,4 +1,5 @@
|
|
1
1
|
LICENSE
|
2
|
+
MANIFEST.in
|
2
3
|
README.md
|
3
4
|
pyproject.toml
|
4
5
|
setup.py
|
@@ -40,4 +41,6 @@ myosotis_researches/CcGAN/utils/concat_image.py
|
|
40
41
|
myosotis_researches/CcGAN/utils/make_h5.py
|
41
42
|
myosotis_researches/CcGAN/utils/opts.py
|
42
43
|
myosotis_researches/CcGAN/utils/print_hdf5.py
|
43
|
-
myosotis_researches/CcGAN/utils/train.py
|
44
|
+
myosotis_researches/CcGAN/utils/train.py
|
45
|
+
myosotis_researches/CcGAN/visualize/__init__.py
|
46
|
+
myosotis_researches/CcGAN/visualize/visualize_datasets.py
|
@@ -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"]
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="Myosotis-Researches",
|
5
|
-
version="0.1.
|
5
|
+
version="0.1.11",
|
6
6
|
description="A repository for storing my progress of researches.",
|
7
7
|
long_description=open("README.md").read(),
|
8
8
|
long_description_content_type="text/markdown",
|
@@ -10,6 +10,7 @@ setup(
|
|
10
10
|
author_email="xie.zeyu20@gmail.com",
|
11
11
|
url="https://github.com/Zeyu-Xie/Myosotis-Researches",
|
12
12
|
packages=find_packages(),
|
13
|
+
include_package_data=True,
|
13
14
|
install_requires=[],
|
14
15
|
classifiers=[
|
15
16
|
"Programming Language :: Python :: 3",
|
File without changes
|
File without changes
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/Myosotis_Researches.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/make_h5.py
RENAMED
File without changes
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/opts.py
RENAMED
File without changes
|
File without changes
|
{myosotis_researches-0.1.10 → myosotis_researches-0.1.11}/myosotis_researches/CcGAN/utils/train.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|