@@ -2,9 +2,9 @@ This project contains data compression ops and layers for TensorFlow. The
22project website is at
33[ tensorflow.github.io/compression] ( https://tensorflow.github.io/compression ) .
44
5- You can use this library to build your own ML models with optimized lossy data
6- compression built in. It's useful to find storage-efficient representations of
7- your data (features, examples, images, etc.) while only sacrificing a tiny
5+ You can use this library to build your own ML models with end-to-end optimized
6+ data compression built in. It's useful to find storage-efficient representations
7+ of your data (features, examples, images, etc.) while only sacrificing a tiny
88fraction of model performance. It can compress any floating point tensor to a
99much smaller sequence of bits.
1010
@@ -16,45 +16,97 @@ completed, it encodes floating point tensors into optimal bit sequences by
1616automating the design of probability tables and calling a range coder
1717implementation behind the scenes.
1818
19- For an introduction to lossy data compression with machine learning, take a look
20- at @jonycgn 's
19+ For an introduction to lossy image compression with machine learning, take a
20+ look at @jonycgn 's
2121[ talk on Learned Image Compression] ( https://www.youtube.com/watch?v=x_q7cZviXkY ) .
2222
2323# Quick start
2424
25- Install TensorFlow 1.13.
25+ ## Installing release 1.1 (stable)
2626
27- ** Please note ** : We are currently transitioning to providing pip packages. At
28- this point, the master will not work. Make sure to use the released version .
27+ Install TensorFlow 1.13 using one of the methods described in the
28+ [ TensorFlow installation instructions ] ( https://www.tensorflow.org/install ) .
2929
30- Download the
31- [ ZIP file for release v1.1] ( https://github.com/tensorflow/compression/releases/tag/v1.1 )
30+ Download the ZIP file for
31+ [ release v1.1] ( https://github.com/tensorflow/compression/releases/tag/v1.1 )
3232and unpack it. Then include its root directory in your ` PYTHONPATH `
3333environment variable:
3434
3535``` bash
3636cd < target directory>
37- git clone https://github.com/tensorflow/compression.git tensorflow_compression
38- export PYTHONPATH=" $PWD /tensorflow_compression:$PYTHONPATH "
37+ wget https://github.com/tensorflow/compression/archive/v1.1.zip
38+ unzip v1.1.zip
39+ export PYTHONPATH=" $PWD /compression-1.1:$PYTHONPATH "
3940```
4041
4142To make sure the library imports succeed, try running the unit tests:
4243
4344``` bash
44- cd tensorflow_compression
45- for i in tensorflow_compression/python/* /* _test.py; do
46- python $i
47- done
45+ cd compression-1.1
46+ for i in tensorflow_compression/python/* /* _test.py; do python $i ; done
4847```
4948
49+ ## Installing release 1.2b1 (beta)
50+
51+ Set up an environment in which you can install precompiled binary Python
52+ packages using the ` pip ` command. Refer to the
53+ [ TensorFlow installation instructions] ( https://www.tensorflow.org/install/pip )
54+ for more information on how to set up such a Python environment.
55+
56+ Run the following command to install the binary PIP package:
57+
58+ ``` bash
59+ pip install tensorflow-compression
60+ ```
61+
62+ *** Note: for this beta release, we only support Python 2.7 and 3.4 versions on
63+ Linux platforms. We are working on Darwin (Mac) binaries as well. For the time
64+ being, if you need to run the beta release on Mac, we suggest to use Docker
65+ Desktop for Mac, and run the above command inside a container based on the
66+ [ TensorFlow docker image] ( https://www.tensorflow.org/install/docker ) for
67+ Python 2.7.***
68+
69+ ## Using the library
70+
5071We recommend importing the library from your Python code as follows:
5172
5273``` python
5374import tensorflow as tf
5475import tensorflow_compression as tfc
5576```
5677
57- ## Example model
78+ ## Using a pre-trained model to compress an image
79+
80+ *** Note: you need to have a release >1.1 installed for pre-trained model
81+ support.***
82+
83+ In the
84+ [ examples directory] ( https://github.com/tensorflow/compression/tree/master/examples ) ,
85+ you'll find a python script ` tfci.py ` . Download the file and run:
86+
87+ ``` bash
88+ python tfci.py -h
89+ ```
90+
91+ This will give you a list of options. Briefly, the command
92+
93+ ``` bash
94+ python tfci.py compress < model> < PNG file>
95+ ```
96+
97+ will compress an image using a pre-trained model and write a file ending in
98+ ` .tfci ` . Execute ` python tfci.py models ` to give you a list of supported
99+ pre-trained models. The command
100+
101+ ``` bash
102+ python tfci.py decompress < TFCI file>
103+ ```
104+
105+ will decompress a TFCI file and write a PNG file. By default, an output file
106+ will be named like the input file, only with the appropriate file extension
107+ appended (any existing extensions will not be removed).
108+
109+ ## Training your own model
58110
59111The
60112[ examples directory] ( https://github.com/tensorflow/compression/tree/master/examples )
@@ -64,10 +116,9 @@ contains an implementation of the image compression model described in:
64116> J. Ballé, V. Laparra, E. P. Simoncelli<br />
65117> https://arxiv.org/abs/1611.01704
66118
67- To see a list of options, change to the directory and run:
119+ To see a list of options, download the file ` bls2017.py ` and run:
68120
69121``` bash
70- cd examples
71122python bls2017.py -h
72123```
73124
0 commit comments