KrishnaswamyLab / TrajectoryNet

TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics
Other
100 stars 14 forks source link

Ran script but not sure how to generate the trajectory GIF #7

Open sushantbangru opened 4 years ago

sushantbangru commented 4 years ago

Hi,

I ran the following code; python3 main.py --dataset ../hep_fmnn.npz --embedding_name phate

After finished running generated a bunch of results in results/tmp/ folder including 100s of jpegs like this... 2200_2

Is there a separate code for generating GIF, I looked at a similar issue someone else raised, and made a change they say, which led to another folder named trajectory with figures like these, but still no mp4 file. viz-00000

Thanks for your help.

Sushant

atong01 commented 4 years ago

Hi Shushant, when things work correctly there should be a mp4 along with those jpegs. The code that does this is in TrajectoryNet/lib/viz_scrna.py. it works by producing a bunch of snapshot images and sticking them together with ffmpeg. I would guess that ffmpeg is not working correctly on your system.

SK124 commented 4 years ago

@sushantbangru Did you figure it out? I have all the jpegs made by the model during training, along with the weights after 1000 epochs. Now I need the gif alone instead of training from scratch as i have the weights. What did you do?

sushantbangru commented 4 years ago

As @atong01 suggested above for me the ffmpeg was an issue. I just installed/updated it and now it is working. But I basically reran the thing with fewer iterations to check. It is working now.

@SK124 you can try using something like easy video maker if you don't want to rerun the training.

@atong01 now that I got the mp4 file created, it seems there are some arbitary timepoints like 48 hr, 12, 18 and 30 days, which I didn't mention. Also, why is the x-axis a little shrunk from the left making the area on the left basically empty?

atong01 commented 4 years ago

Sorry, I was hacking for the deadline and left in the custom matplotlib ticklabels. Just fixed this in /lib/viz_scrna.py line 358. That is the function that generates the density plots so if you want anything to look different (colormap, labels etc.) I would look there.

Note that if you run things with the --test flag then it will attempt to load the last checkpoint from wherever you set --save and plot output without training.

SK124 commented 4 years ago

image @sushantbangru I used ffmpeg separately and I got the video, unfortunately it does not look the same as the gif posted in the repo readme