Reference utils
This file describes methods associated with dataset analysis and loading.
Analysis
compute_span(df)
Compute the time span of the dataset.
The span is defined as the latest time minus the earliest time of image taken. The times are computed separately for each individual.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A full dataframe of the data. |
required |
Returns:
Type | Description |
---|---|
float
|
The span of the dataset in seconds. |
Source code in wildlife_datasets/analysis/statistics.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
display_statistics(df, unknown_name='')
Prints statistics about the dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A full dataframe of the data. |
required |
unknown_name |
str
|
Name of the unknown class. |
''
|
Source code in wildlife_datasets/analysis/statistics.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
Loading
get_dataframe_path(root_dataframe, class_dataset)
Creates path to the pickled dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_dataframe |
str
|
Path where all dataframes are stored. |
required |
class_dataset |
type
|
Type of DatasetFactory. |
required |
Returns:
Type | Description |
---|---|
str
|
Path to the dataframe. |
Source code in wildlife_datasets/loader/loader.py
20 21 22 23 24 25 26 27 28 29 30 31 |
|
get_dataset_folder(root_dataset, class_dataset)
Creates path to the dataset data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_dataset |
str
|
Path where all datasets are stored. |
required |
class_dataset |
type
|
Type of DatasetFactory. |
required |
Returns:
Type | Description |
---|---|
str
|
Path to the stored data. |
Source code in wildlife_datasets/loader/loader.py
7 8 9 10 11 12 13 14 15 16 17 18 |
|
load_dataset(class_dataset, root_dataset, root_dataframe, overwrite=False, **kwargs)
Loads dataset from a pickled dataframe or creates it.
If the dataframe is already saved in a pkl file, it loads it. Otherwise, it creates the dataframe and saves it in a pkl file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_dataset |
type
|
Type of DatasetFactory to load. |
required |
root_dataset |
str
|
Path where all datasets are stored. |
required |
root_dataframe |
str
|
Path where all dataframes are stored. |
required |
overwrite |
bool
|
Whether the pickled dataframe should be overwritten. |
False
|
Returns:
Type | Description |
---|---|
DatasetFactory
|
The loaded dataset. |
Source code in wildlife_datasets/loader/loader.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
load_datasets(class_datasets, root_dataset, root_dataframe, **kwargs)
Loads multiple datasets as described in load_dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_datasets |
List[type]
|
List of types of DatasetFactory to download. |
required |
root_dataset |
str
|
Path where all datasets are stored. |
required |
root_dataframe |
str
|
Path where all dataframes are stored. |
required |
Returns:
Type | Description |
---|---|
List[DatasetFactory]
|
The list of loaded datasets. |
Source code in wildlife_datasets/loader/loader.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|