birdfsd_yolov5.publishing package

Submodules

birdfsd_yolov5.publishing.generate_release module

class GenerateRelease(run_path: str, version: str, train_folder: str, val_folder: str, dataset_folder: str, repo: Optional[str] = None, overwrite: bool = False)[source]

Bases: object

Generate a release for a model.

find_file(run, fname: str) Optional[Union[tuple, list]][source]

Finds a file in a run and uploads it to imgbb.

Parameters
  • run – The W&B run to use for the release.

  • fname (str) – A string, the name of the file to be found.

generate() None[source]

This method generates the release.

The method does the following: 1. Creates a directory for the release. 2. Gets the f1-score of the run. 3. Gets some data assets from the run. 4. Creates the release notes. 5. Generates a command to create the release on GitHub.

get_assets(run) Optional[tuple][source]

Accesses the run files to get relevant assets.

Downloads the best model from the run with the given ID, extracts the model’s configuration, & classes and saves them to a file.

Parameters

run – The W&B run to use for the release.

release_notes(run, f1_score: float) str[source]

Creates a release notes file.

Parameters
  • run – The W&B run to use for the release.

  • f1_score (float) – The F1 score of the current run.

Returns

The content of the release notes file.

Return type

str

birdfsd_yolov5.publishing.sync_model module

exception ModelVersionFormatError[source]

Bases: Exception

Exception raised when a model version is not in the correct format.

class SyncModel(model_version: str, model_name: str, run_path: str, classes_file: str, weights_file: str, weights_enc: str, config_file: str, train_date: str)[source]

Bases: object

add_new_version() dict[source]

updates the database with the latest version.

This method updates the database with the latest version of the model. It first gets the labels from the database, then adds the new version of the model to the model collection in the database.

Returns

The model that was added to the database.

Return type

dict

check_version_number_format() str[source]

Check the format of the model version.

Notes

The version number should be in the format of ‘vX.Y.Z’ or ‘vX.Y.Z-alpha.N’.

Returns

The match object if the version is valid, None otherwise.

Return type

re.Match

Raises

ModelVersionFormatError – If the version is not valid.

Module contents