{
  "id": 126940,
  "title": "paralellize pre-processing ...how? any tips?",
  "url": "/competitions/deepfake-detection-challenge/discussion/126940",
  "author_name": "dagnelies",
  "post_date": "2020-01-21T08:23:32.919000",
  "votes": 5,
  "comment_count": 14,
  "views": 0,
  "content": "<p>Hi,\nI'd like to pre-process the videos before I train my models. However, it is quite a challenge. In my case, I need a couple of seconds to process a video ...but these few seconds per video implies a few hours per zipped directory and several days for the whole! ☹️ ...which is very very time consuming.</p>\n\n<p>What would you recommend to parallelize this pre-processing? Ideally, the same code could be run on different modest machines (download data, process, save output) with just a variable being different (the input dir). However, I don't really know how to realize this. Do you have any tip how this could be achieved? (without super complex stuff)</p>",
  "messages": [
    {
      "id": 724542,
      "postDate": "2020-01-21T08:23:32.920Z",
      "content": "<p>Hi,\nI'd like to pre-process the videos before I train my models. However, it is quite a challenge. In my case, I need a couple of seconds to process a video ...but these few seconds per video implies a few hours per zipped directory and several days for the whole! ☹️ ...which is very very time consuming.</p>\n\n<p>What would you recommend to parallelize this pre-processing? Ideally, the same code could be run on different modest machines (download data, process, save output) with just a variable being different (the input dir). However, I don't really know how to realize this. Do you have any tip how this could be achieved? (without super complex stuff)</p>",
      "rawMarkdown": "Hi,\nI'd like to pre-process the videos before I train my models. However, it is quite a challenge. In my case, I need a couple of seconds to process a video ...but these few seconds per video implies a few hours per zipped directory and several days for the whole! ☹️ ...which is very very time consuming.\n\nWhat would you recommend to parallelize this pre-processing? Ideally, the same code could be run on different modest machines (download data, process, save output) with just a variable being different (the input dir). However, I don't really know how to realize this. Do you have any tip how this could be achieved? (without super complex stuff)\n\n \n",
      "votes": 5
    },
    {
      "id": 725101,
      "postDate": "2020-01-21T19:54:31.263Z",
      "content": "<p>Can you provide batches of images to MTCNN? If so, that would be a good idea. I actually put multiple frames from multiple videos into a single batch and send this to my face detection model. While the face detector is running, I already prepare the next batch of images. My face detector is relatively small, so I can make batches of a few hundred images and process them in a single go.</p>",
      "rawMarkdown": "Can you provide batches of images to MTCNN? If so, that would be a good idea. I actually put multiple frames from multiple videos into a single batch and send this to my face detection model. While the face detector is running, I already prepare the next batch of images. My face detector is relatively small, so I can make batches of a few hundred images and process them in a single go.",
      "votes": 2,
      "replies": [
        {
          "id": 725214,
          "postDate": "2020-01-21T22:43:52.493Z",
          "content": "<p>You certainly get a speed up from this, but IMHO it is still not ideal to process everything on a single machine. </p>\n\n<p>The total video time is around 120k*10sec ...which is about 2 weeks of video length if you concatenate everything. If you are able process the videos in real-time at around 30 frames/sec, which is not so bad, it would still take you two weeks.</p>",
          "rawMarkdown": "You certainly get a speed up from this, but IMHO it is still not ideal to process everything on a single machine. \n\nThe total video time is around 120k*10sec ...which is about 2 weeks of video length if you concatenate everything. If you are able process the videos in real-time at around 30 frames/sec, which is not so bad, it would still take you two weeks."
        },
        {
          "id": 727073,
          "postDate": "2020-01-23T12:43:44.517Z",
          "content": "<p><a href=\"/humananalog\">@humananalog</a> I am new entrant to this competition.\nCould you guide me on what sort of preprocessing is needed. Is it like people are extracting the face from video frame storing them as images then using for classification ?</p>",
          "rawMarkdown": "@humananalog I am new entrant to this competition.\nCould you guide me on what sort of preprocessing is needed. Is it like people are extracting the face from video frame storing them as images then using for classification ?"
        },
        {
          "id": 727140,
          "postDate": "2020-01-23T13:45:05.370Z",
          "content": "<p>I think that's the approach most people (including myself) are using: extract a bunch of faces from the training videos and use those to train a binary image classifier. </p>\n\n<p>So far I haven't paid much attention to the actual training, only to building a good dataset (I'm using a ResNeXt50 model that was pretrained on ImageNet and then trained for 6 or so epochs on my dataset of face crops). Every time I moved up the leaderboard it has been because I improved my face crops and how they get loaded into batches during training.</p>",
          "rawMarkdown": "I think that's the approach most people (including myself) are using: extract a bunch of faces from the training videos and use those to train a binary image classifier. \n\nSo far I haven't paid much attention to the actual training, only to building a good dataset (I'm using a ResNeXt50 model that was pretrained on ImageNet and then trained for 6 or so epochs on my dataset of face crops). Every time I moved up the leaderboard it has been because I improved my face crops and how they get loaded into batches during training.",
          "votes": 2
        },
        {
          "id": 727174,
          "postDate": "2020-01-23T14:05:43.650Z",
          "content": "<p>Thanks.. with least attn you are in top 30 .... with more you wil be in top 3 :)</p>\n\n<p>Any pointer to kernel which is doing face extraction task or any  dataset which has generated the faces ?</p>",
          "rawMarkdown": "Thanks.. with least attn you are in top 30 .... with more you wil be in top 3 :)\n\nAny pointer to kernel which is doing face extraction task or any  dataset which has generated the faces ?"
        }
      ]
    },
    {
      "id": 760588,
      "postDate": "2020-03-01T13:49:25.620Z",
      "content": "<p>I am gathering some code snippets here: <a href=\"https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225\">https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225</a>.\nHave a look and let me know if you need more tips. \nNotice that it is a WIP, so I will be adding more snippets along the way. Check it regularly. ;) </p>",
      "rawMarkdown": "I am gathering some code snippets here: https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225.\nHave a look and let me know if you need more tips. \nNotice that it is a WIP, so I will be adding more snippets along the way. Check it regularly. ;) "
    },
    {
      "id": 732528,
      "postDate": "2020-01-29T23:09:13.027Z",
      "content": "<p>Nice idea, I guess it makes sense to make use of the model already trained on thousands of images. I understand it must give way better results than having to build your own from scratch on the data provided. </p>",
      "rawMarkdown": "Nice idea, I guess it makes sense to make use of the model already trained on thousands of images. I understand it must give way better results than having to build your own from scratch on the data provided. "
    },
    {
      "id": 732430,
      "postDate": "2020-01-29T20:16:57.250Z",
      "content": "<p><a href=\"/humananalog\">@humananalog</a> Thanks for sharing your ideas. You mentioned you are using a ResNet-based model pre-trained on ImageNet? Do you mind me asking what are you using it for?</p>",
      "rawMarkdown": "@humananalog Thanks for sharing your ideas. You mentioned you are using a ResNet-based model pre-trained on ImageNet? Do you mind me asking what are you using it for?",
      "replies": [
        {
          "id": 732510,
          "postDate": "2020-01-29T22:45:00.480Z",
          "content": "<p>To classify real faces vs. fake faces. The model is pretrained but I use transfer learning to turn it into a real-vs-fake face classifier (like pretty much everyone in this competition is doing).</p>",
          "rawMarkdown": "To classify real faces vs. fake faces. The model is pretrained but I use transfer learning to turn it into a real-vs-fake face classifier (like pretty much everyone in this competition is doing).",
          "votes": 2
        }
      ]
    },
    {
      "id": 729810,
      "postDate": "2020-01-26T16:54:28.820Z",
      "content": "<p>processing such large amount of data is really slow and tedious ...I haven't found yet a satisfying way to parallelize the pre-processing, despite having invested quite some time. Everyone talks about the scalability of the cloud but there isn't even a simple way to run a single script on multiple machines ...grrr ...it's driving me nuts.</p>",
      "rawMarkdown": "processing such large amount of data is really slow and tedious ...I haven't found yet a satisfying way to parallelize the pre-processing, despite having invested quite some time. Everyone talks about the scalability of the cloud but there isn't even a simple way to run a single script on multiple machines ...grrr ...it's driving me nuts."
    },
    {
      "id": 726563,
      "postDate": "2020-01-23T04:44:23.397Z",
      "content": "<p>I tried to do that but got killed somehow.</p>",
      "rawMarkdown": "I tried to do that but got killed somehow."
    },
    {
      "id": 724773,
      "postDate": "2020-01-21T13:21:41.560Z",
      "content": "<p>This would really help the cause. Currently, I'm using tensorflow. Is it possible to run multiple instances of MTCNN on the same GPU?</p>",
      "rawMarkdown": "This would really help the cause. Currently, I'm using tensorflow. Is it possible to run multiple instances of MTCNN on the same GPU?",
      "replies": [
        {
          "id": 732631,
          "postDate": "2020-01-30T03:03:14.100Z",
          "content": "<p>Right, so this is possible. But each instance slows down.</p>",
          "rawMarkdown": "Right, so this is possible. But each instance slows down."
        }
      ]
    },
    {
      "id": 729858,
      "postDate": "2020-01-26T18:12:01.613Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 725101,
      "author_name": "Human Analog",
      "author_url": "",
      "post_date": "2020-01-21T19:54:31.263000",
      "content": "<p>Can you provide batches of images to MTCNN? If so, that would be a good idea. I actually put multiple frames from multiple videos into a single batch and send this to my face detection model. While the face detector is running, I already prepare the next batch of images. My face detector is relatively small, so I can make batches of a few hundred images and process them in a single go.</p>",
      "votes": 2,
      "replies": [
        {
          "id": 725214,
          "author_name": "dagnelies",
          "author_url": "",
          "post_date": "2020-01-21T22:43:52.493000",
          "content": "<p>You certainly get a speed up from this, but IMHO it is still not ideal to process everything on a single machine. </p>\n\n<p>The total video time is around 120k*10sec ...which is about 2 weeks of video length if you concatenate everything. If you are able process the videos in real-time at around 30 frames/sec, which is not so bad, it would still take you two weeks.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 727073,
          "author_name": "Jaideep",
          "author_url": "",
          "post_date": "2020-01-23T12:43:44.517000",
          "content": "<p><a href=\"/humananalog\">@humananalog</a> I am new entrant to this competition.\nCould you guide me on what sort of preprocessing is needed. Is it like people are extracting the face from video frame storing them as images then using for classification ?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 727140,
          "author_name": "Human Analog",
          "author_url": "",
          "post_date": "2020-01-23T13:45:05.370000",
          "content": "<p>I think that's the approach most people (including myself) are using: extract a bunch of faces from the training videos and use those to train a binary image classifier. </p>\n\n<p>So far I haven't paid much attention to the actual training, only to building a good dataset (I'm using a ResNeXt50 model that was pretrained on ImageNet and then trained for 6 or so epochs on my dataset of face crops). Every time I moved up the leaderboard it has been because I improved my face crops and how they get loaded into batches during training.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 727174,
          "author_name": "Jaideep",
          "author_url": "",
          "post_date": "2020-01-23T14:05:43.650000",
          "content": "<p>Thanks.. with least attn you are in top 30 .... with more you wil be in top 3 :)</p>\n\n<p>Any pointer to kernel which is doing face extraction task or any  dataset which has generated the faces ?</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 760588,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2020-03-01T13:49:25.620000",
      "content": "<p>I am gathering some code snippets here: <a href=\"https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225\">https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225</a>.\nHave a look and let me know if you need more tips. \nNotice that it is a WIP, so I will be adding more snippets along the way. Check it regularly. ;) </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 732528,
      "author_name": "Shivangee Trivedi",
      "author_url": "",
      "post_date": "2020-01-29T23:09:13.027000",
      "content": "<p>Nice idea, I guess it makes sense to make use of the model already trained on thousands of images. I understand it must give way better results than having to build your own from scratch on the data provided. </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 732430,
      "author_name": "Shivangee Trivedi",
      "author_url": "",
      "post_date": "2020-01-29T20:16:57.250000",
      "content": "<p><a href=\"/humananalog\">@humananalog</a> Thanks for sharing your ideas. You mentioned you are using a ResNet-based model pre-trained on ImageNet? Do you mind me asking what are you using it for?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 732510,
          "author_name": "Human Analog",
          "author_url": "",
          "post_date": "2020-01-29T22:45:00.480000",
          "content": "<p>To classify real faces vs. fake faces. The model is pretrained but I use transfer learning to turn it into a real-vs-fake face classifier (like pretty much everyone in this competition is doing).</p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 729810,
      "author_name": "dagnelies",
      "author_url": "",
      "post_date": "2020-01-26T16:54:28.820000",
      "content": "<p>processing such large amount of data is really slow and tedious ...I haven't found yet a satisfying way to parallelize the pre-processing, despite having invested quite some time. Everyone talks about the scalability of the cloud but there isn't even a simple way to run a single script on multiple machines ...grrr ...it's driving me nuts.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 726563,
      "author_name": "Shangqiu Li",
      "author_url": "",
      "post_date": "2020-01-23T04:44:23.397000",
      "content": "<p>I tried to do that but got killed somehow.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 724773,
      "author_name": "Akash",
      "author_url": "",
      "post_date": "2020-01-21T13:21:41.560000",
      "content": "<p>This would really help the cause. Currently, I'm using tensorflow. Is it possible to run multiple instances of MTCNN on the same GPU?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 732631,
          "author_name": "Akash",
          "author_url": "",
          "post_date": "2020-01-30T03:03:14.100000",
          "content": "<p>Right, so this is possible. But each instance slows down.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 729858,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-01-26T18:12:01.613000",
      "content": "",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "724542": "Hi,\nI'd like to pre-process the videos before I train my models. However, it is quite a challenge. In my case, I need a couple of seconds to process a video ...but these few seconds per video implies a few hours per zipped directory and several days for the whole! ☹️ ...which is very very time consuming.\n\nWhat would you recommend to parallelize this pre-processing? Ideally, the same code could be run on different modest machines (download data, process, save output) with just a variable being different (the input dir). However, I don't really know how to realize this. Do you have any tip how this could be achieved? (without super complex stuff)\n\n \n",
    "725101": "Can you provide batches of images to MTCNN? If so, that would be a good idea. I actually put multiple frames from multiple videos into a single batch and send this to my face detection model. While the face detector is running, I already prepare the next batch of images. My face detector is relatively small, so I can make batches of a few hundred images and process them in a single go.",
    "760588": "I am gathering some code snippets here: https://www.kaggle.com/c/deepfake-detection-challenge/discussion/133225.\nHave a look and let me know if you need more tips. \nNotice that it is a WIP, so I will be adding more snippets along the way. Check it regularly. ;) ",
    "732528": "Nice idea, I guess it makes sense to make use of the model already trained on thousands of images. I understand it must give way better results than having to build your own from scratch on the data provided. ",
    "732430": "@humananalog Thanks for sharing your ideas. You mentioned you are using a ResNet-based model pre-trained on ImageNet? Do you mind me asking what are you using it for?",
    "729810": "processing such large amount of data is really slow and tedious ...I haven't found yet a satisfying way to parallelize the pre-processing, despite having invested quite some time. Everyone talks about the scalability of the cloud but there isn't even a simple way to run a single script on multiple machines ...grrr ...it's driving me nuts.",
    "726563": "I tried to do that but got killed somehow.",
    "724773": "This would really help the cause. Currently, I'm using tensorflow. Is it possible to run multiple instances of MTCNN on the same GPU?",
    "729858": ""
  }
}