Connect with us

Tech

Google-research / coltran google-research / google-research GitHub on master

Avatar

Published

on


Source code that accompanies the paper Colorization Transformer announced at ICLR2021. Work by Manoj Kumar, Dirk Weissenborn, and Nal Kalchbrenner.

Paper summary

ColTran consists of three components: a colorizer, a color-up sampler, and a space-up sampler.

The colorizer is an autoregressive, self-attention-based architecture consisting of conditional translayers. Roughly colors low-resolution 64×64 grayscale images pixel by pixel. Color-up samplers are parallel, deterministic, self-attention-based networks. Refines coarse, low-resolution images into 64×64 RGB images. The architecture of the space-up sampler is similar to the color-up sampler. Supersolves low resolution RGB images to final output. The colorizer has an auxiliary parallel color prediction model that consists of a single linear layer.

We report the results after training these individual components on a 4×4 TPU v2 chip. Adjust the model size and batch size while training with less resources. The results of training these components with less resources are given in the appendix.

The complete configuration used to train the model in paper is available in the directory configs. Very small model configurations are provided in test_configs to test that the model builds quickly. For quick logging, set the flag –steps_per_summaries = 100. When sampling, set config.sample.log_dir to the appropriate write directory.

Requirements pipinstall -rrequirements.txt Training

Train the colorizer by running the following command

python -m coltran.run –config = coltran / configs / colorizer.py –mode = train –logdir = / colorizer_ckpt_dir

To train color and space upsamplers, replace configs / colorizer.py with configs / color_upsampler.py and configs / spatial_upsampler.py, respectively.

Evaluation

For evaluation

python -m coltran.run –config = coltran / configs / colorizer.py –mode = eval_valid –logdir = / colorizer_ckpt_dir Sampling Single GPU sampling

Sampling high resolution images is a three-step procedure. On P100 GPUs, the colorizer samples a batch of 20 images in 3-5 minutes, and the color and spatial upsampler samples on the order of milliseconds.

The sampling configuration for each model is described in config.sampleConfigDict in configs /.py.

sample.num_outputs-Total number of grayscale images sample.logdir-Sample write directory. sample.gen_data_dir-Path to where the sample from the previous step is stored. sample.skip_batches-First skip_batches from public imagenetTF * batch_size image-Dataset will be skipped.

Make sure that num_outputs and skip_batches are the same for all three components. The generated sample is written to $ logdir / $ {config.sample.logdir} as TFRecords.

Color riser

This command samples a low resolution coarse color 64×64 image.

python -m coltran.sample –config = coltran / configs / colorizer.py –mode = sample_test –logdir = / colorizer_ckpt_dir Color up sampler

This command converts the coarse 64×64 image from the previous step to a fine 64×64 image.

Note: Set the color-up sampler configuration config.sample.gen_data_dir to /colorizer_ckpt_dir/${config.sample.logdir}.

python -m coltran.sample –config = coltran / configs / color_upsampler.py –mode = sample_test –logdir = / cup_ckpt_dir Spatial Upsampler

This command super-resolutions the previous output to a high resolution 256×256 output.

Note: Set the spatial upsampler configuration config.sample.gen_data_dir to $ / cup_ckpt_dir / $ {config.sample.logdir}.

python -m coltran.sample –config = coltran / configs / Spatial_upsampler.py –mode = sample_test –logdir = / cup_ckpt_dir Multi-GPU sampling

Sampling can be parallelized between batches in a multi-GPU setup using the flag config.sample.skip_batches. For example, in a 2 machine and 20 batch size setup, to color 100 grayscale images per machine, set config.sample.skip_batches on the 1st and 2nd machines to 0 and 5, respectively. Set to.

Pre-trained checkpoints

We will release a pre-trained checkpoint on ImageNet at the following URL:

Colorizer-Link Color Up Sampler-Link Space Up Sampler-Link

To sample, download them to your local directory, set the logdir flag to your local path, and run the sampling script.

Reference tensor board

An overview of train operations is available on tensorboard.dev.

Colorizer-Link Color Up Sampler-Link Space Up Sampler-Link Analysis TF Records

The generated TF record can be easily converted to an image with the following code

def parse_example (example_proto, res = 64): features = {‘image’: tf.io.FixedLenFeature ([res*res*3], Tf.int64)} example = tf.io.parse_example (example_proto, features = features) image = tf.reshape (example)[‘image’], (Res, res, 3)) return image gen_dataset = tf.data.TFRecordDataset (listdir (path)) gen_dataset = gen_dataset.map (lambda x: parse_example (x, res)) gen_dataset = iter (gen_dataset) for image in gen_dataset : Plt.imshow (image) quote

If you use the code or model, please cite our treatise.

@inproceedings {kumar2021colorization, title = {Colorization Transformer}, author = {Manoj Kumar and Dirk Weissenborn and Nal Kalchbrenner}, booktitle = {International Conference on Learning Representations}, year = {2021}, url = {https: // openreview. net / forum? id = 5NA1PinlGFu}}

What Are The Main Benefits Of Comparing Car Insurance Quotes Online

LOS ANGELES, CA / ACCESSWIRE / June 24, 2020, / Compare-autoinsurance.Org has launched a new blog post that presents the main benefits of comparing multiple car insurance quotes. For more info and free online quotes, please visit https://compare-autoinsurance.Org/the-advantages-of-comparing-prices-with-car-insurance-quotes-online/ The modern society has numerous technological advantages. One important advantage is the speed at which information is sent and received. With the help of the internet, the shopping habits of many persons have drastically changed. The car insurance industry hasn't remained untouched by these changes. On the internet, drivers can compare insurance prices and find out which sellers have the best offers. View photos The advantages of comparing online car insurance quotes are the following: Online quotes can be obtained from anywhere and at any time. Unlike physical insurance agencies, websites don't have a specific schedule and they are available at any time. Drivers that have busy working schedules, can compare quotes from anywhere and at any time, even at midnight. Multiple choices. Almost all insurance providers, no matter if they are well-known brands or just local insurers, have an online presence. Online quotes will allow policyholders the chance to discover multiple insurance companies and check their prices. Drivers are no longer required to get quotes from just a few known insurance companies. Also, local and regional insurers can provide lower insurance rates for the same services. Accurate insurance estimates. Online quotes can only be accurate if the customers provide accurate and real info about their car models and driving history. Lying about past driving incidents can make the price estimates to be lower, but when dealing with an insurance company lying to them is useless. Usually, insurance companies will do research about a potential customer before granting him coverage. Online quotes can be sorted easily. Although drivers are recommended to not choose a policy just based on its price, drivers can easily sort quotes by insurance price. Using brokerage websites will allow drivers to get quotes from multiple insurers, thus making the comparison faster and easier. For additional info, money-saving tips, and free car insurance quotes, visit https://compare-autoinsurance.Org/ Compare-autoinsurance.Org is an online provider of life, home, health, and auto insurance quotes. This website is unique because it does not simply stick to one kind of insurance provider, but brings the clients the best deals from many different online insurance carriers. In this way, clients have access to offers from multiple carriers all in one place: this website. On this site, customers have access to quotes for insurance plans from various agencies, such as local or nationwide agencies, brand names insurance companies, etc. "Online quotes can easily help drivers obtain better car insurance deals. All they have to do is to complete an online form with accurate and real info, then compare prices", said Russell Rabichev, Marketing Director of Internet Marketing Company. CONTACT: Company Name: Internet Marketing CompanyPerson for contact Name: Gurgu CPhone Number: (818) 359-3898Email: [email protected]: https://compare-autoinsurance.Org/ SOURCE: Compare-autoinsurance.Org View source version on accesswire.Com:https://www.Accesswire.Com/595055/What-Are-The-Main-Benefits-Of-Comparing-Car-Insurance-Quotes-Online View photos



picture credit

ExBUlletin

to request, modification Contact us at Here or [email protected]