...
Simple usage
Code Block | ||
---|---|---|
| ||
classifierdas-element-cli.exe {file} |
Code Block | ||
---|---|---|
| ||
classifier# Linux & Mac das-element-cli /path/to/file.#.exr # Windows C:\das-element-cli.exe C:\path\to\file.#.exr # result: {"/path/to/file.#.exr": [{"label": "fire", "description": "rapid oxidation of a material", "value": "Q3196"}]} |
...
You can pass multiple file paths to the software.
Code Block | ||
---|---|---|
| ||
classifierdas-element-cli.exe {file1} {file2} {file3} |
Code Block | ||
---|---|---|
| ||
classifierdas-element-cli.exe /path/to/files.#.exr /path/to/another/file.mov # result: {"/path/to/files.#.exr": [{"label": "fire", "description": "rapid oxidation of a material", "value": "Q3196"}], "/path/to/another/file.mov": [{"label": "torch", "description": "stick with a flaming end used as a source of light", "value": "Q327954"}]} |
...
Code Block | ||
---|---|---|
| ||
classifierdas-element-cli.exe -top 3 /path/to/file.mov # result: {"/path/to/file.mov": [ {"label": "torch", "description": "stick with a flaming end used as a source of light", "value": "Q327954"}, {"label": "fire", "description": "rapid oxidation of a material", "value": "Q3196"}, {"label": "flame", "description": "visible, gaseous part of a fire", "value": "Q235544"} ]} |
...
Code Block | ||
---|---|---|
| ||
# print the top 3 label predictions for a given file path import json import subprocess path = '/path/to/file.mov' command = ['./classifierdas-element-cli.exe', '--top', '3', path] process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, error = process.communicate() if process.returncode != 0: print('Something went wrong: {} - Error: {}'.format(path, error)) else: result = json.loads(output) for path, predictions in result.items(): wikidata_ids = [item['value'] for item in predictions] # list of IDs from wikidata readable_labels = [item['label'] for item in predictions] # list of human readable labels print('For path: "{}" predicted the labels: {}'.format(path, ', '.join(readable_labels))) # result: # For path: "/path/to/file.mov" predicted the labels: torch, flame, fire |
...
Get information about the current software version and the categories that can be classified.
Code Block | ||
---|---|---|
| ||
classifierdas-element-cli.exe --info |
key | description |
---|---|
| the identifier for the class from Wikidata |
| meaningful readable label |
| a list of different words for this class |
...