Model download tutorial

This tutorial is aimed at those who don’t want to have the program fetch a model when it is not already downloaded.

Beginning with version 1.7.0 of VEAI there are many different models the program can use. So far they are forward-compatible, and newer versions than 1.7.0 can use models from 1.7.0 and later. It is possible to download all, or specific, models and store them.

There are currently 4 variants for the models for different GPU types, and the files have the following endings/extensions:

-ov.tz (openvino)
-ml.tz (coreml)
fp32 -ox.tz (onnx)
fp16 -ox.tz (onnx16)

Find your models folder; if you don’t know where to look, open the program and choose Help/Open Log Folder. Go up one level and you should see the models folder. Look at the files in that folder, and you will see which GPU type VEAI is picking for you - all of the files for 288x288 will be there in 1x, 2x, and 4x versions, plus any already downloaded. For me it is fp16 -ox.tz Also in that folder will be files with a .json extension, which tells the program what models to use.

There are 9 HxW variants of each file, and three size versions, except for thf which has only single unsized version. The HeightxWidth list is:
256x352
288x288 (you shouldn’t need to download this one since it comes with the installer)
384x480
480x384
384x672
448x576
576x384
576x416
576x672

At this writing there are ddv, dtd, dtv, aaa, alq, amq, ahq, thf, thd, ghq, and gcg models. (edited January 2021)

Basically you can use the 288x288 files to build a list of all files, repeating file names with the other sizes, plus addding the URL. Here are examples from mine:
http://veai-models.topazlabs.com/alq-v10-gnet-fp16-576x384-1x-ox.tz
http://veai-models.topazlabs.com/alq-v10-fnet-fp16-576x384-1x-ox.tz
http://veai-models.topazlabs.com/ddv-v1-gnet-fp16-384x480-4x-ox.tz
http://veai-models.topazlabs.com/ddv-v1-fnet-fp16-384x480-4x-ox.tz

I build the entire list in a text file.

For the download you can do them one-at-a-time or use a batch downloader. I use a program called jDownloader (free) and it will pull from the Windows clipboard, so just select the files to download and copy. I’m sure there are other batch downloaders available. If people have favorites please chime in. Either download directly to your models folder, or move them after download.

One important point: New VEAI installs will wipe out your models folder! Unless you want to download again and again, make a backup copy that you can copy back into the models folder. To put, for example, alq-v7 in along with alq-v8 just copy the models and also the artemis-lq-7.json file. When you do, both V7 and V8 will be choices in the program.

Let me know if this tutorial needs to be expanded or clarified.

2 Likes

The information you’ve provided and your time are much appreciated, but is there some reason you know of why these files can’t be installed locally from the UI? For that matter, any reason this isn’t simply handled as a checkbox/option in the standard installation/update process?

Kind of a baffling UI/UX design choice; incredibly inconvenient workflow (not to mention the lack of cropping, or batch processing multiple time selections)…

As it stands, it seems like this program should have a giant flashing warning label next to the checkout button that reads- “WARNING: THIS SOFTWARE REQUIRES A CONSTANT INTERNET CONNECTION TO WORK CORRECTLY!”…

First, there is no warning of that sort because it would be untrue. The models included with the install will produce the same results as if all of the models were there, they just won’t be quite as fast for many videos.

The full set of models is huge, over 10GB for any particular GPU. Topaz is probably correct in assuming that most users are connected to the net, and only models actually used will require downloading. If, for example, you are upscaling 100 SD videos to HD, you will only need a single optimized model that will be downloaded with first use and not thereafter.

This is one of those things where they were going to be criticized no matter what they did. My workaround will probably be used by only a tiny percentage of users.

My apologies, I don’t get it. What advantage do I have when I download the models this way? If it matters: I am connected to the internet 24/7 with a 1Gb/s connection, so downloading is no issue for me.

It might save you a second the first time you use a different model, but otherwise no advantage. I aimed this at people like myself, where my VEAI machine is normally not connected to the internet.

Separately, most people would not know that a couple of us who have been doing this routinely have been able to notify Topaz on at least three occasions when files were missing for download.

I respectfully disagree. Your situation is not unique or for that matter uncommon. Many people live in places with unreliable internet (where I live currently), or limited bandwidth (where I’m moving in 2 weeks). The very fact that you felt the need to write the original post proves that you understand this well. 10GB is an inconsequential amount of storage on modern hardware; like many, I currently have upwards of 20TB…

“they just won’t be quite as fast for many videos.”…? I say that safely qualifies as “NOT WORKING CORRECTLY”. Why would customers be denied the option to run optimized models without constant interruptions or fast/reliable internet?

Need I remind you, I’m not ‘inventing’ something different here, what I am describing is simply a consistent experience to all other Topaz (/any other decent, professional) software. Download and install what is needed; update when necessary; DON’T MAKE MY WORKFLOW/SPEED/EFFICIENCY DEPENDENT ON OFFSITE SERVERS, ESPECIALLY WHEN I WAS NEVER WARNED THAT WOULD BE THE CASE.

please correct me if i’m wrong, but it seems likely that the reasonable/honest answer here, is that they already spend a lot on bandwidth pushing out 2GB updates for Gigapixel etc. and the only reason I can see that this would not be standard/optional during install or from a menu, is Topaz trying to save a couple of pennies on more bandwidth. I get it, I just don’t like it.

Your first paragraph has contradictory statements, You acknowledge that many people have poor connections or limited bandwidth, yet you expect them to download far more data in the installer than they need? Note that, for a Windows installer, the amount wouldn’t be 10GB it would be at least triple that because their are three sets of files depending on the hardware of the user.

The storage issue is mostly a problem of Topaz’s making - they put all of the data on the system disc. I doubt that I’m unusual in having a lot of space (I have ‘only’ 12TB here) but a tiny percentage of that is on the boot drive. They have suggested that they may give us a choice of storage location in the future, but that is the way it is now.

I download all of the fp16 files, as much as anything as an exercise, but I don’t keep them in the models folder. I use Artemis LQ almost exclusively, so its the only set of files that I keep completely in the models folder.

I made this to parse the json files and create a list of urls for the models

import os
import json

base_url = 'http://veai-models.topazlabs.com/'

# comment out backends you want to use
ignored_backends = [
    'openvino',
    'tensorflow',
    'coreml',
    'onnx',
    #'onnx16',
]

sizes = [
    '256x352',
    '288x288',
    '384x480',
    '480x384',
    '384x672',
    '448x576',
    '576x384',
    '576x416',
    '576x672'
]

model_files = []

def get_model_urls():
    files = os.walk('.').__next__()[2]
    for file in files:
        
        if not file.endswith('.json'):
            continue
        
        with open(file, 'r') as f:
            data = json.load(f)
        
        if type(data) is not dict:
            continue
        
        model = data.get('shortName', None)
        version = data.get('version', None)
        backends = data.get('backends', None)
        
        if None in (model, version, backends):
            continue
        
        for backend_name, backend_data in backends.items():
            if backend_name in ignored_backends:
                continue
            
            parse_backend(model, version, backend_data)
    
    with open('model_urls.txt', 'w') as f:
        for file in model_files:
            f.write('{}{}\n'.format(base_url, file))


def parse_backend(model, version, backend):
    for scale_factor, scale_data in backend['scales'].items():
        for file in scale_data['nets']:
            
            file = file.replace('[N]', model)
            file = file.replace('[V]', version)
            file = file.replace('[S]', scale_factor)
            
            if '[H]x[W]' not in file:
                model_files.append(file)
                continue
            
            for size in sizes:
                file_size = file.replace('[H]x[W]', size)
                model_files.append(file_size)


get_model_urls()

You mention that old models work with later versions of VEAI and can be downloaded. When I upgraded to VEAI version 1.9, the alq-v9 models were replaced with v10 which didn’t work as well for my application. I restored from backup to downgrade to the previous VEAI. I don’t see how to download previous models. I see where the models directory is — I could just keep a copy of the previous models if they’re still compatible. Will this still work, and is there a better way?

All model versions from 1.7.0 to 1.9.0 are compatible with 1.9.0. No need to move back in versions, you just want the v9 files. You can use the instructions above to download them, but you will also need the .json files. The .json files are plain text, so if you take, for example, artemis-lq-10.json and make a copy, then name the copy artemis-lq-9.json, then open it and change the version on line 2 from 10 to 9 it will work with v9 files.

I maintain a separate models backup that has every file that I might be interested in at a future point. When a new version is installed and deletes most of my models I just copy them along with their .json files back in.

1 Like

Thanks! So to hang onto all my existing models, just in case, it seems all I need to do is make a copy of the models folder before I upgrade, and then copy anything I want into the new version. I’m on a Mac, where all of these files are part of the app bundle (“Contents/Resources/models”).

I’m totally clueless when it comes to Macs, but I would assume that copying to another location would work as it does in Windows, and that’s the easiest way to keep old models available.