tsv

deepdataspace.plugins.tsv

This module supports tsv dataset format.

importer

Import the tsv dataset and save metadata into mongodb.

class TSVImporter(dataset_path: str, enforce: bool = False)[source]

Bases: FileImporter

Importer for tsv dataset.

open_files()[source]
close_files()[source]
pre_run()[source]

A pre-run hook for subclass importers to prepare data.

on_error(err: Exception)[source]

A hook to handle error.

post_run()[source]

A post-run hook for subclass importers to clean up data.

load_objects(image: Dict, label_name: str, label_type: str, objects: list, image_data_off: int, image_data_str: str, file_path: str, line_idx: int) List[Dict][source]
static read_line(file_data: dict)[source]
load_groundtruth() Tuple[Optional[Dict], Optional[List[Dict]]][source]
load_prediction(image: Dict, pred_name: str)[source]
load_predictions(image: Dict) List[Dict][source]
static can_import(path: str)[source]

Check if the given path can be imported by this importer.

collect_files() dict[source]

Collect the files related to this dataset, {file_tag: file_path}.

process

deepdataspace.plugins.tsv.process

Implement all processors for tsv dataset.

class RankByFlags(dataset_path: str, enforce: bool = False)[source]

Bases: BaseProcessor

classmethod dependencies() List[str][source]

What processors this processor is depending on.

classmethod should_auto_run() bool[source]

Should this processor automatically run at program start?

can_process()[source]
process_dataset()[source]

Process a subset of this dataset. Derived class should implement this interface accordingly.

task_func = <@task: RankByFlags of dds>

server

deepdataspace.plugins.tsv.server

Add RESTful APIs for tsv dataset.

class Task(id: str, name: str, status: str, trigger_at: int, start_at: int, finish_at: int)[source]

Bases: object

A task model for rerank_by_flags task.

id: str
name: str
status: str
trigger_at: int
start_at: int
finish_at: int
class ReRankImagesByFlagsTasksView(**kwargs)[source]

Bases: APIView

Add an API to trigger a task to rerank images by dataset flags.

post_args = [<deepdataspace.utils.http.Argument object>]
post(request)[source]

Trigger a task to rerank images by dataset flags.

class ReRankImagesByFlagsTaskView(**kwargs)[source]

Bases: APIView

Add an API to query result of rerank_by_flags task.

get(request, task_id: str)[source]

Query result of rerank_by_flags task.