Endeavour10020 / AiCity-2021-Track4

This is the repository of NVIDIA Aicity Challenge Track4.
0 stars 0 forks source link

Suggestions for upcoming code #1

Open Mandroide opened 3 years ago

Mandroide commented 3 years ago

I have tested several anomaly detection repositories source code, and most of them didn't work. I have some advice for the upcoming code

Essential

import argparse
import pathlib

def parse_cli() -> argparse.ArgumentParser:
    current_directory = pathlib.Path(__file__).resolve().parent
    parser = argparse.ArgumentParser(description="Extract frames from directory containing videos.")
    parser.add_argument("--root", type=pathlib.Path, help="directory containing videos to be processed",
                        default=current_directory / "sample_video")
    parser.add_argument("--ext", type=str, help="extensions of the videos within the directory to be processed",
                        default="mp4")

    return parser
import time

def main(args: argparse.Namespace) -> int:
    start_time = time.perf_counter()

    # Some code

    end_time = time.perf_counter()
    res = time.strftime("%Hh:%Mm:%Ss", time.gmtime(end_time - start_time))
    print(f"Finished in {res}")
    return 0

if __name__ == "__main__":
    main(parse_cli().parse_args())

The reason of encapsulating the running code within the main function, you can find it in main — Top-level code environment

Optional

Laulian commented 3 years ago

@Mandroide can i have the anomaly detection repositories source code you mentioned above? Best regards,

Mandroide commented 3 years ago

@Mandroide can i have the anomaly detection repositories source code you mentioned above? Best regards,

2020

2019

2018