Participants are to submit a compressed Docker image in the tar.gz format onto the challenge platform. This repository serves as a step by step guide to help participants with creating a valid submission for the Trusted Media Challenge.
We would be using Docker for this challenge so that participants can choose their preferred programming languages and dependencies to create the best perfoming detection models.
To build and run GPU accelerated Docker containers, please install the NVIDIA Container Toolkit.
git clone https://github.com/AISG-Technology-Team/Trusted-Media-Challenge-Submission-Example.git
cd sample_submission
docker build -t sample_image .
Please take note of the “.” indicates the current project directory and should be added into the docker build command to provide the build context.
Add a few mp4 videos into local_test/test_input and replace "/path/to/cloned/repo" in the following command with the full path to the cloned repo. The test is successful if no error messages were seen and a submission.csv is created in the local_test/test_output directory.
docker run --rm -it \
-v /path/to/cloned/repo/local_test/test_input:/data/input \
-v /path/to/cloned/repo/local_test/test_output:/data/output \
sample_image \
-input /data/input/ -output /data/output/submission.csv
Compress your sample image to .tar.gz format using docker save
docker save sample_image:latest | gzip > sample_image.tar.gz
Submit your sample_image.tar.gz
file onto the challenge platform
The process of creating your own submission would be very similar to using the aforementioned sample submission.
mkdir Trusted-Media-Challenge && cd Trusted-Media-Challenge
The main file has to accept two arguments:
-input
is a directory which contains all videos of the test set, e.g. /data/input/ ('/' should appear at the end of the line)-output
is the name (with path) of the output file, e.g. /data/output/submission.csv
and has three main functions:
- Read the mp4 videos from directory specified in the aforementioned
-input
argument - Predicts the probability that each input video is fake
- Writes a csv output file with the name and at the path specified in the aforementioned
-output
argument. The csv file should contain two columns filename and probability where probability is the estimated probability that the video, stated in filename, is fake. An example csv is provided.
You may refer to the main.py
of the sample submission as an example of a main file.
You may use the sample Dockerfile provided for you. However, please install the relevant dependencies required for your detection model. Additionally, you may wish to change the ENTRYPOINT if you are using another main file or if you prefer to use a shell script:
ENTRYPOINT ["bash","/path/to/your/main.sh"]
If you are not familiar with building a Dockerfile, please refer to the official documentation for more information.
Build your Docker image using docker build
docker build -t your_image .
Please take note of the “.” indicates the current project directory and should be added into the docker build command to provide the build context.
mkdir local_test && cd local_test
mkdir test_input test_output
4. Test your image using docker run
Please replace "/path/to/test/dir" in the following command with the full path to your test directory. The test is successful if no error messages were seen and a submission.csv is created in the local_test/test_output directory.
docker run --rm -it --gpus ‘”device=0”’ \
-v /path/to/test/dir/local_test/test_input:/data/input \
-v /path/to/test/dir/local_test/test_output:/data/output \
your_image \
-input /data/input/ -output /data/output/submission.csv
Please note that above docker run command on the sample image would be equivalent to running the following command in the container:
python /app/main.py -input /data/input/ -output /data/output/submission.csv
Compress your Docker image to .tar.gz format using docker save
docker save your_image:latest | gzip > your_image.tar.gz
Submit your your_image.tar.gz
file onto the challenge platform