Skip to content

Commit cdd5d8b

Browse files
authored
Merge pull request #1 from esologic/migration_1
Migration 1
2 parents 2a0d7da + 91aeb05 commit cdd5d8b

91 files changed

Lines changed: 9671 additions & 41 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/python:3.6.9
5+
- image: circleci/python:3.6.8
66
environment:
77
TZ: "America/New_York"
88
working_directory: ~/repo
@@ -34,7 +34,7 @@ jobs:
3434
- run:
3535
name: Run Tests
3636
command: |
37-
./tools/run_tests.sh 'not integration'
37+
./tools/run_tests.sh 'not (integration or gpu)'
3838
3939
- run:
4040
name: Run Pylint

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,8 @@ ENV/
103103

104104
# pycharm
105105
.idea/
106+
107+
# Ignore picked networks by default
108+
*.pkl
109+
*.wav
110+
*.hdf5

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "gance/stylegan2"]
2+
path = gance/stylegan2
3+
url = https://github.com/esologic/stylegan2_gance

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ multi_line_output=3
44
include_trailing_comma=True
55
force_grid_wrap=0
66
use_parentheses=True
7-
skip=/home/circleci/repo/venv,./venv
7+
skip=/home/circleci/repo/venv,./venv,./gance/stylegan2
88
extra_standard_library = setuptools

.pylintrc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extension-pkg-whitelist=cv2
77

88
# Add files or directories to the blacklist. They should be base names, not
99
# paths.
10-
ignore=CVS,venv
10+
ignore=CVS,venv,stylegan2
1111

1212
# Add files or directories matching the regex patterns to the blacklist. The
1313
# regex matches against base names, not paths.
@@ -132,7 +132,10 @@ disable=invalid-name,
132132
bad-continuation, # ignore multiline def reflow
133133
ungrouped-imports, # handled by isort
134134
logging-fstring-interpolation,
135-
no-else-return
135+
no-else-return,
136+
duplicate-code,
137+
too-few-public-methods, # conflicts with good practice of using NTs, Protocols etc
138+
unspecified-encoding
136139

137140

138141
# Enable the message, report, category or checker with the given id(s). You can
@@ -302,7 +305,15 @@ ignore-on-opaque-inference=yes
302305
# List of class names for which member attributes should not be checked (useful
303306
# for classes with dynamically set attributes). This supports the use of
304307
# qualified names.
305-
ignored-classes=optparse.Values,thread._local,_thread._local,Observable
308+
ignored-classes=thread._local,
309+
_thread._local,
310+
SingleVector,
311+
ConcatenatedVectors,
312+
DividedVectors,
313+
SingleMatrix,
314+
ConcatenatedMatrices,
315+
DividedMatrices,
316+
RGBInt8ImageType
306317

307318
# List of module names for which member attributes should not be checked
308319
# (useful for modules/projects where namespaces are manipulated during runtime

CHANGELOG.md

Lines changed: 178 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,184 @@
11
# Changelog
22

3+
0.17.0 - (2021-11-22)
4+
------------------
5+
6+
* Breaking up project and renaming it `GANce` for publication on GitHub.
7+
* Added a number of examples for a blog post explaining this project [here](https://www.esologic.com/gance/).
8+
9+
10+
0.16.1 - (2021-10-28)
11+
------------------
12+
13+
* Fixed a bug in synthesis file reader/writer. Both now use the standard vector types.
14+
15+
16+
0.16.0 - (2021-10-23)
17+
------------------
18+
19+
* This version will create the final projection files for the yellow album cover project.
20+
* In `project_video_to_file.py`, added ability to process multiple input videos at once. Either
21+
a directory of videos or multiple videos passed via CLI. Added unit testing for this as well.
22+
* Created a few projection specific docker containers in `docker-compose.yml` based on the `develop`
23+
model.
24+
* Added a very small cli, `read_projection_file.py` to read a projection file and turn the final
25+
images vs. target images into a video.
26+
27+
28+
0.15.0 - (2021-10-17)
29+
------------------
30+
31+
* In `project_video_to_file.py`, added ability to override the fps of the input video. Use with
32+
caution.
33+
* Added type system for key data types. Images, Vectors/Matrices, Latents etc. See comment in
34+
readme but these are mostly to aid in documentation.
35+
* Cleaned up repo structure a bit during refactor to add types, but still some things that need to
36+
be deleted.
37+
* Added integration style testing of projection file reader and writer that require GPU.
38+
39+
0.14.0 - (2021-10-12)
40+
------------------
41+
42+
* Added visualization/numeric analysis functionality to decide the projection steps and projection
43+
FPS that will be used in the production projections.
44+
* Added a number of helper functions to make working with projection files more expedient.
45+
* Fixed bug in `synthesis_file_into_models.py`
46+
47+
48+
0.13.0 - (2021-09-20)
49+
------------------
50+
51+
* Added a CLI to, given a directory of models, create a number of random output images, some with
52+
and some without faces. This tool, `images_from_models.py` will be used to create the prod album
53+
cover.
54+
* Introduced notion of a synthesis file, which is a json file produced alongside the images
55+
previously mentioned which records the associated vector and model used to create the image.
56+
* Added a CLI `synthesis_file_into_models.py` to read one of these synthesis file jsons and input
57+
the vector into a list of models to see the "growth" of a given output image over time.
58+
* Added a CLI to go from a list of directories of models to a single directory of renamed and
59+
validated models. `check_move_models.py` will be used on training VM to copy the batch 2 models.
60+
* Created tooling to visualize projection files, including a deterministic way to see when
61+
projection stops improving to inform the big prod run. No CLI for any of this yet.
62+
* Added CLI to input a vector file or vector files into a model or models and save the resulting
63+
images.
64+
* Fixed bug where the iterators in `read_projection_file` were not in the correct order, needed
65+
to parse dataset name and then sort by the key int in the filename.
66+
* More usability features for working with projection files.
67+
* Added more functions in `vector_sources` to service researching how to best reduce number of
68+
frames/projection steps needed in the final runs.
69+
* Started to add testing that is GPU non-optional.
70+
71+
0.12.0 - (2021-09-12)
72+
------------------
73+
74+
* Adds lots of new functionality around creating projections (going from an arbitrary image to
75+
vectors that could be input to the model to re-create the arbitrary image) programmatically.
76+
* Introduces concept of a "projection file", a HDF5 file that contains the massive amount of
77+
data related to a projection.
78+
* Adds video -> projection file. `stylegan2` natively supports projecting single images but with
79+
this addition we can project videos.
80+
* There are a number of crufty assets/visualization functions hanging around. These'll get
81+
removed before publication but were helpful in understanding this new technology.
82+
83+
84+
0.11.0 - (2021-08-22)
85+
------------------
86+
87+
* Small release to get new functionality out before working on new big feature.
88+
* Adds a few more things to the vector primitives file to better explore the latent space of models.
89+
* Improves visualization functions, adding ability to quickly input a vector array into a model etc.
90+
91+
92+
0.10.0 - (2021-08-03)
93+
------------------
94+
95+
* Massive refactoring of the matplotlib data visualization pipeline in order to better label the
96+
data in each of the visualizations, and to add visualizations for the dynamic model index.
97+
* Added audio compression that uses gzip as the basis for reduction.
98+
* Created a CLI, `music_into_models.py` to select `.wav` files and directories of models for
99+
visualization.
100+
* Added standalone visualization for audio reducers to aide in development.
101+
* Switched local version of `stylegan2` to a fork where resuming from a crashed job is possible.
102+
103+
104+
0.9.0 - (2021-07-16)
105+
------------------
106+
107+
* Added functionality to switch between models during a run, allowing a mapping between audio
108+
complexity and the resulting "training resolution" of the output image.
109+
* Added ability to compute the rolling RMS power of an audio file, this is fed into the function
110+
that switches models during a run.
111+
112+
113+
0.8.0 - (2021-07-07)
114+
------------------
115+
116+
* There was a massive bug in `smooth_across_vectors`, and that function didn't do at all what I
117+
thought it did.
118+
* Added flags to disable 2d/3d visualizations alongside model outputs in `vectors_into_model.py`.
119+
* Re-worked Spectrogram code to remove the need for the scaling step.
120+
* To the main visualization function, `viz_model_ins_outs`, added the ability to, in 2d
121+
see both sides of the combination (music, noise, combined), had to modify types here which will
122+
be extended later.
123+
124+
125+
0.7.0 - (2021-06-24)
126+
------------------
127+
128+
* Updated `docker-compose.yml` and the various `*.Dockerfile`s to create the production dataset of
129+
images for the yellow album cover. There isn't a lot of abstraction on those config files, and it's
130+
pretty specific to this project but everything is there.
131+
132+
133+
0.6.0 - (2021-06-22)
134+
------------------
135+
136+
* Created `select_images_for_training.py` to use face recognition to select a sets of images for
137+
training.
138+
139+
0.5.0 - (2021-06-17)
140+
------------------
141+
142+
* Improved `begin_dataset_upload.py`, added ability to detect if a given dataset was "partially
143+
uploaded" meaning that the copy operation from the dataset directory to the ownCloud directory
144+
wasn't able to finish.
145+
146+
147+
0.4.0 - (2021-05-25)
148+
------------------
149+
150+
* Modified `read_wav_scale_for_video` to work on an entire `np.ndarray` of vectors rather
151+
than the `Sampler`-style re-sample from before.
152+
* Added this function to `_visualize_audio_file_and_model_output` so it can stretch wav files to
153+
make sure there are enough vectors to have high frame rate video.
154+
* Generally encapsulated this workflow so it's more discrete and easier to apply over multiple
155+
audio files at once.
156+
* Added functionality to add audio files to output videos directly.
157+
* Updated linters to pick up the loose `.py` files in this repo's top directory.
158+
159+
160+
0.3.0 - (2021-05-20)
161+
------------------
162+
163+
* Created dockerfiles, `docker-compose` configs to run
164+
dataset creation, and model training as `docker-compose run` commands.
165+
166+
167+
0.2.0 - (2021-05-15)
168+
------------------
169+
170+
* Adds functionality to go from vector array -> spectrogram as an input to the model.
171+
172+
173+
0.1.0 - (2021-05-13)
174+
------------------
175+
176+
* Massive merge, I've been lazy about splitting up features.
177+
* Work on using docker to develop model visualizations.
178+
* Added basic music visualizations.
179+
3180

4-
0.0.1 - (2021-11-20)
181+
0.0.1 - (2020-10-21)
5182
------------------
6183

7184
* Project begins

README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
# GANce - gance
22

3-
Maps music and video into the latent space of StyleGAN models.
3+
![Sample network output](./gance_sample.png)
44

5-
## Usage
6-
7-
#### Environment variables
8-
9-
Add if needed
10-
11-
#### Correct usage
12-
13-
With the virtual env activated, run:
14-
15-
```
16-
python gance.py --fill-me-in
17-
```
18-
19-
#### Incorrect usage
20-
21-
Add if needed
5+
Maps music and video into the latent space of StyleGAN networks.
226

7+
See [esologic.com/gance](https://www.esologic.com/gance) for more information.
238

249
## Getting Started
2510

@@ -45,7 +30,33 @@ There's also a bin script to do this:
4530
## Developer Guide
4631

4732
The following is documentation for developers that would like to contribute
48-
to GANce.
33+
to GANCe.
34+
35+
### Type System Limitations
36+
37+
A common idiom found in this application is the following:
38+
39+
```python
40+
# Shape (1, Any, Any)
41+
CompleteLatentsType = NewType("CompleteLatentsType", "np.ndarray[np.float32]") # type: ignore
42+
```
43+
44+
Where a `NewType` is created based on an `np.ndarray`. This doesn't really do anything outside
45+
of making the programs a bit more simple to understand to the reader. The following would pass
46+
`mypy`:
47+
48+
```python
49+
CompleteLatentsType("oh no!")
50+
```
51+
52+
This is because:
53+
* We're stuck on `numpy==1.16.4` because of the `tensorflow` dependency of `stylegan2`.
54+
* `np.ndarray` types are `Any` as far as `mypy` is concerned in this version.
55+
* When you `NewType("MyType", Any)`, it stops `mypy` from being able to identify type mismatches.
56+
57+
Read more here: https://github.com/python/mypy/issues/6701
58+
59+
We could resolve this if we take the time to verify that it's okay to upgrade the `numpy` version.
4960

5061
### Pycharm Note
5162

0 commit comments

Comments
 (0)