-
Notifications
You must be signed in to change notification settings - Fork 184
How to run
DeepLeague was designed to run on MacOS and Linux. We need more testing and proper documentation for Windows.
DeepLeague is used via the command line, so it'll be really helpful if you feel confortable using one; anyway, you can pretty much copy paste everything here and be good to go. We don't have a graphical user interface (yet).
You'll need git, conda and brew (only on MacOS). Once you install them you can check if everything works okay by typing in these commands in your terminal.
$ conda
$ git
$ brew # only needed on MacOS
If you were able to run those commands without any errors, you can continue.
# get the repo.
$ git clone https://github.com/farzaa/DeepLeague.git
$ cd DeepLeague
$ cd YAD2K
$ conda create -n DeepLeague python=3.6
$ source activate DeepLeague
$ conda install python.app # this install python as a framework for mat plot lib.
# bunch if packages you need.
# if you are using ubuntu, use this instead https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
# instead of opencv-python.
$ pip install opencv-python youtube_dl
$ conda install -c menpo ffmpeg
$ pip install numpy h5py pillow matplotlib
$ pip install tensorflow
$ pip install keras
# get the supporting files for the neural net.
$ brew install wget
$ brew install ffmpeg --with--libvpx # this may take a while.
$ wget http://pjreddie.com/media/files/yolo.weights
$ wget https://archive.org/download/DeepLeagueWeights/trained_stage_3_best.h5
$ wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolo.cfg
$ pythonw yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 # we need to use pythonw when calling DeepLeague!
Running that last command is extremely important. It might produce some errors which you can hopefully Google and quickly solve. I've found it really is dependent on your system + hardware. If you feel like needing more help, you can always check the project's reported issues or post a new one.
# get the repo
$ git clone https://github.com/farzaa/DeepLeague.git
# get into de repo's folder
$ cd DeepLeague
# set up the new environment
$ conda env create -f requirements.yml
$ source activate DeepLeague
# after running the last command, you should see (DeepLeague) prepended in your shell
# get into de YAD2K folder
$ cd YAD2K
# Download the weights file
$ wget http://pjreddie.com/media/files/yolo.weights
$ wget https://archive.org/download/DeepLeagueWeights/trained_stage_3_best.h5
$ wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolo.cfg
# run the command to configure the model
$ python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5
Running that last command is extremely important. It might produce some errors which you can hopefully Google and quickly solve. I've found it really is dependent on your system + hardware. If you feel like needing more help, you can always check the project's reported issues or post a new one.
Honestly, this repo has so many tiny functions. But, let me explain the easiest way to get this going if all you want to do is analyze a VOD (which most of you want I presume). the test_deep_league.py
is the key to running everything. Its a little command line tool I made that lets you input a VOD to analyze using three different ways: a YouTube link, path to local MP4, path to a directory of images. I like the YouTube link option best, but if you have trouble with it feel free to use the MP4 approach instead. All you need is a 1080P VOD of a League game. Its extremely important its 1080p or else my scripts will incorrectly crop the mini map. Also, DeepLeague is only trained on mini maps from 1080P video. Other sizes aren't tested.
Here's an example of me running the tool with a YouTube link. This method automatically downloads the YT video as well and cuts it up according to the the start and end time you gave it. It will automatically do all the renaming to process stuff.
This command specifies to start at the 30 second mark and end 1 minute in. This is useful when you only want to analyze a part of a VOD. The frames that are output are saved to the "output" folder as specified by the command below.
pythonw test_deep_league.py -out output youtube -yt https://www.youtube.com/watch?v=vPwZW1FvtWA -yt_path /output -start 0:00:30 -end 0:01:00
# if you're using Linux
python test_deep_league.py -out output youtube -yt https://www.youtube.com/watch?v=vPwZW1FvtWA -yt_path /output -start 0:00:30 -end 0:01:00
You should first see the download start:
Then you should see DeepLeague start predicting bounding boxes.
If you want to use a local mp4 file that you recorded yourself use the command below where -mp4 tells the script where the VOD is on your computer.
pythonw test_deep_league.py -out output mp4 -mp4 /Volumes/DATA/data/data/C9_CLG_G_2_MARCH_12_2017/vod.mp4
Download it here.
I've split the dataset into multiple .npz files so it isn't just one massive file. I mainly did this to make batch training easier. I've compressed it down to one big 30GB file you can wget
at this link. I recommend wget
because it can resume failed downloads. The worst feeling is when a big download is about to finish and your internet crashes causing you to lose the entire download.
Also, I have already split the dataset into training, testing, and validation sets which splits the data into 80%, 17.5%, and 2.5% cuts respectively. These .npz files only have the cropped mini maps frames and the bounding box information associated with every frame.
If you want help reading this npz file, check out def visualize_npz_data
here.