Merge pull request #137 from faceshiftlabs/fix/web-ui-previews-png

Fix/web UI previews png
This commit is contained in:
Jeremy Hummel 2021-03-29 03:17:09 -07:00 committed by GitHub
commit ae1e177ab3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View file

@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### In Progress ### In Progress
- [Freezeable layers (encoder/decoder/etc.)](https://github.com/faceshiftlabs/DeepFaceLab/tree/feature/freezable-weights) - [Freezeable layers (encoder/decoder/etc.)](https://github.com/faceshiftlabs/DeepFaceLab/tree/feature/freezable-weights)
## [1.5.0] - 2020-03-29
### Changed
- Web UI previews now show preview pane as PNG (loss-less), instead of JPG (lossy), so we can see the same output
as on desktop, without any changes from JPG compression. This has the side-effect of the preview images loading slower
over web, as they are now larger, a future update may be considered which would give the option to view as JPG
instead.
## [1.4.2] - 2020-03-26 ## [1.4.2] - 2020-03-26
### Fixed ### Fixed
- Fixes bug in background power with MS-SSIM, that misattributed loss from dst to src - Fixes bug in background power with MS-SSIM, that misattributed loss from dst to src
@ -73,7 +80,8 @@ This should help with rough areas directly next to the mask
- Reset stale master branch to [seranus/DeepFaceLab](https://github.com/seranus/DeepFaceLab), - Reset stale master branch to [seranus/DeepFaceLab](https://github.com/seranus/DeepFaceLab),
21 commits ahead of [iperov/DeepFaceLab](https://github.com/iperov/DeepFaceLab) ([compare](https://github.com/iperov/DeepFaceLab/compare/4818183...seranus:3f5ae05)) 21 commits ahead of [iperov/DeepFaceLab](https://github.com/iperov/DeepFaceLab) ([compare](https://github.com/iperov/DeepFaceLab/compare/4818183...seranus:3f5ae05))
[Unreleased]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.2...HEAD [Unreleased]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.5.0...HEAD
[1.4.2]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.2...v1.5.0
[1.4.2]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.1...v1.4.2 [1.4.2]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.1...v1.4.2
[1.4.1]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.0...v1.4.1 [1.4.1]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.4.0...v1.4.1
[1.4.0]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.3.0...v1.4.0 [1.4.0]: https://github.com/faceshiftlabs/DeepFaceLab/compare/v1.3.0...v1.4.0

View file

@ -10,7 +10,7 @@ def create_flask_app(s2c, c2s, s2flask, kwargs):
log = logging.getLogger('werkzeug') log = logging.getLogger('werkzeug')
log.disabled = True log.disabled = True
model_path = Path(kwargs.get('saved_models_path', '')) model_path = Path(kwargs.get('saved_models_path', ''))
filename = 'preview.jpg' filename = 'preview.png'
preview_file = str(model_path / filename) preview_file = str(model_path / filename)
def gen(): def gen():
@ -20,7 +20,7 @@ def create_flask_app(s2c, c2s, s2flask, kwargs):
frame = open(preview_file, 'rb').read() frame = open(preview_file, 'rb').read()
except: except:
pass pass
yield b'--frame\r\nContent-Type: image/jpeg\r\n\r\n' yield b'--frame\r\nContent-Type: image/png\r\n\r\n'
yield frame yield frame
yield b'\r\n\r\n' yield b'\r\n\r\n'
@ -81,7 +81,7 @@ def create_flask_app(s2c, c2s, s2flask, kwargs):
@app.route('/preview_image') @app.route('/preview_image')
def preview_image(): def preview_image():
return send_file(preview_file, mimetype='image/jpeg', cache_timeout=-1) return send_file(preview_file, mimetype='image/png', cache_timeout=-1)
socketio = SocketIO(app) socketio = SocketIO(app)

View file

@ -404,7 +404,7 @@ def main(**kwargs):
zoom) zoom)
# io.show_image(wnd_name, preview_pane_image) # io.show_image(wnd_name, preview_pane_image)
model_path = Path(kwargs.get('saved_models_path', '')) model_path = Path(kwargs.get('saved_models_path', ''))
filename = 'preview.jpg' filename = 'preview.png'
preview_file = str(model_path / filename) preview_file = str(model_path / filename)
cv2.imwrite(preview_file, preview_pane_image) cv2.imwrite(preview_file, preview_pane_image)
s2flask.put({'op': 'show'}) s2flask.put({'op': 'show'})