{
  "id": 135593,
  "title": "Cuda error",
  "url": "/competitions/deepfake-detection-challenge/discussion/135593",
  "author_name": "pter",
  "post_date": "2020-03-14T19:51:30.715000",
  "votes": 0,
  "comment_count": 7,
  "views": 0,
  "content": "<p>I was running my code and it worked well at 10 am UTC+00 but at 4pm UTC+00 the same code did not work anymore and showed the following error message:</p>\n\n<p><code>Error while calling cudaGetLastError() in file /tmp/pip-install-hdz9ztcw/dlib/dlib/cuda/gpu_data.cpp:114. code: 2, reason: out of memory.</code></p>\n\n<p>This error happens when using GPU to run input through CNN model however using GPU to train network works still.</p>",
  "messages": [
    {
      "id": 771985,
      "postDate": "2020-03-14T22:06:24.330Z",
      "content": "<p>If the code is the same, then maybe the inputs aren't the same, cause you are using some random when choosing the images or videos to process.\nOut of memory on dlib, is most likely due to the frame size (or batch size, if you are batching) being to big for the available GPU memory.</p>",
      "rawMarkdown": "If the code is the same, then maybe the inputs aren't the same, cause you are using some random when choosing the images or videos to process.\nOut of memory on dlib, is most likely due to the frame size (or batch size, if you are batching) being to big for the available GPU memory.",
      "replies": [
        {
          "id": 772252,
          "postDate": "2020-03-15T08:29:38.503Z",
          "content": "<p>Thank you Nuno for replying. Actually the input has also been the same and batch size is as well (size 1). I was testing my code with the test videos and then after it processed them (in 2 hours) I tested again and it didn't work.</p>\n\n<p>By reducing the image size by 8, the <code>dlib</code> worked every now and then but of course with that small image size it didn't recognize the faces.</p>",
          "rawMarkdown": "Thank you Nuno for replying. Actually the input has also been the same and batch size is as well (size 1). I was testing my code with the test videos and then after it processed them (in 2 hours) I tested again and it didn't work.\n\nBy reducing the image size by 8, the `dlib` worked every now and then but of course with that small image size it didn't recognize the faces."
        },
        {
          "id": 773813,
          "postDate": "2020-03-15T23:47:23.207Z",
          "content": "<p>It seems you use dlib cnn-based face detection model. I see2 ways to solve your issue:\n- split image into overlapping chunks and run face model through them. It would require additional cleanup if some face rectangles repeat. \n- use MTCNN as face detector. It had no problem running 4K stream on a single card.</p>",
          "rawMarkdown": "It seems you use dlib cnn-based face detection model. I see2 ways to solve your issue:\n- split image into overlapping chunks and run face model through them. It would require additional cleanup if some face rectangles repeat. \n- use MTCNN as face detector. It had no problem running 4K stream on a single card."
        },
        {
          "id": 775043,
          "postDate": "2020-03-16T08:21:46.777Z",
          "content": "<p>Thank you Vlad for replying. Yes I used cnn-based face detection. Splitting image into smaller crops would make quite a lot extra work to face detection. I also tried MTCNN but its accuracy is not as good as that dlib cnn detection. Actually, I also noticed that dlib cannot be used anyway because it is not installed to Kaggle servers and competition rules say that no additional libraries can be used in the final evaluation.</p>",
          "rawMarkdown": "Thank you Vlad for replying. Yes I used cnn-based face detection. Splitting image into smaller crops would make quite a lot extra work to face detection. I also tried MTCNN but its accuracy is not as good as that dlib cnn detection. Actually, I also noticed that dlib cannot be used anyway because it is not installed to Kaggle servers and competition rules say that no additional libraries can be used in the final evaluation."
        },
        {
          "id": 775190,
          "postDate": "2020-03-16T11:49:45.410Z",
          "content": "<p>Actually MTCNN is good for detection (used it in couple of my projects and it works really well). You may want to adjust threshold values to avoid false positives, and minimum face size in case it does not detect yet.</p>\n\n<p>From other side, it seems you can use 1) pretrained model in custom dataset attached to the notebook 2) pre-downloaded python wheel, which you can install then py <code>!pip install /path/to/package</code> in a separate notebook cell.</p>",
          "rawMarkdown": "Actually MTCNN is good for detection (used it in couple of my projects and it works really well). You may want to adjust threshold values to avoid false positives, and minimum face size in case it does not detect yet.\n\nFrom other side, it seems you can use 1) pretrained model in custom dataset attached to the notebook 2) pre-downloaded python wheel, which you can install then py `!pip install /path/to/package` in a separate notebook cell."
        },
        {
          "id": 775211,
          "postDate": "2020-03-16T12:17:11.153Z",
          "content": "<p>Aa, ok, thank you for telling this one. I didn't think that uploading wheel file and installing it through the script could be used. This can be useful in other libraries as well.</p>",
          "rawMarkdown": "Aa, ok, thank you for telling this one. I didn't think that uploading wheel file and installing it through the script could be used. This can be useful in other libraries as well."
        }
      ]
    },
    {
      "id": 771919,
      "postDate": "2020-03-14T19:51:30.717Z",
      "content": "<p>I was running my code and it worked well at 10 am UTC+00 but at 4pm UTC+00 the same code did not work anymore and showed the following error message:</p>\n\n<p><code>Error while calling cudaGetLastError() in file /tmp/pip-install-hdz9ztcw/dlib/dlib/cuda/gpu_data.cpp:114. code: 2, reason: out of memory.</code></p>\n\n<p>This error happens when using GPU to run input through CNN model however using GPU to train network works still.</p>",
      "rawMarkdown": "I was running my code and it worked well at 10 am UTC+00 but at 4pm UTC+00 the same code did not work anymore and showed the following error message:\n\n`Error while calling cudaGetLastError() in file /tmp/pip-install-hdz9ztcw/dlib/dlib/cuda/gpu_data.cpp:114. code: 2, reason: out of memory.`\n\nThis error happens when using GPU to run input through CNN model however using GPU to train network works still."
    },
    {
      "id": 772204,
      "postDate": "2020-03-15T06:40:47.090Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 771985,
      "author_name": "Nuno Ferreira",
      "author_url": "",
      "post_date": "2020-03-14T22:06:24.330000",
      "content": "<p>If the code is the same, then maybe the inputs aren't the same, cause you are using some random when choosing the images or videos to process.\nOut of memory on dlib, is most likely due to the frame size (or batch size, if you are batching) being to big for the available GPU memory.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 772252,
          "author_name": "pter",
          "author_url": "",
          "post_date": "2020-03-15T08:29:38.503000",
          "content": "<p>Thank you Nuno for replying. Actually the input has also been the same and batch size is as well (size 1). I was testing my code with the test videos and then after it processed them (in 2 hours) I tested again and it didn't work.</p>\n\n<p>By reducing the image size by 8, the <code>dlib</code> worked every now and then but of course with that small image size it didn't recognize the faces.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 773813,
          "author_name": "Vlad Hrynko",
          "author_url": "",
          "post_date": "2020-03-15T23:47:23.207000",
          "content": "<p>It seems you use dlib cnn-based face detection model. I see2 ways to solve your issue:\n- split image into overlapping chunks and run face model through them. It would require additional cleanup if some face rectangles repeat. \n- use MTCNN as face detector. It had no problem running 4K stream on a single card.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 775043,
          "author_name": "pter",
          "author_url": "",
          "post_date": "2020-03-16T08:21:46.777000",
          "content": "<p>Thank you Vlad for replying. Yes I used cnn-based face detection. Splitting image into smaller crops would make quite a lot extra work to face detection. I also tried MTCNN but its accuracy is not as good as that dlib cnn detection. Actually, I also noticed that dlib cannot be used anyway because it is not installed to Kaggle servers and competition rules say that no additional libraries can be used in the final evaluation.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 775190,
          "author_name": "Vlad Hrynko",
          "author_url": "",
          "post_date": "2020-03-16T11:49:45.410000",
          "content": "<p>Actually MTCNN is good for detection (used it in couple of my projects and it works really well). You may want to adjust threshold values to avoid false positives, and minimum face size in case it does not detect yet.</p>\n\n<p>From other side, it seems you can use 1) pretrained model in custom dataset attached to the notebook 2) pre-downloaded python wheel, which you can install then py <code>!pip install /path/to/package</code> in a separate notebook cell.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 775211,
          "author_name": "pter",
          "author_url": "",
          "post_date": "2020-03-16T12:17:11.153000",
          "content": "<p>Aa, ok, thank you for telling this one. I didn't think that uploading wheel file and installing it through the script could be used. This can be useful in other libraries as well.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 772204,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-03-15T06:40:47.090000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "771985": "If the code is the same, then maybe the inputs aren't the same, cause you are using some random when choosing the images or videos to process.\nOut of memory on dlib, is most likely due to the frame size (or batch size, if you are batching) being to big for the available GPU memory.",
    "771919": "I was running my code and it worked well at 10 am UTC+00 but at 4pm UTC+00 the same code did not work anymore and showed the following error message:\n\n`Error while calling cudaGetLastError() in file /tmp/pip-install-hdz9ztcw/dlib/dlib/cuda/gpu_data.cpp:114. code: 2, reason: out of memory.`\n\nThis error happens when using GPU to run input through CNN model however using GPU to train network works still.",
    "772204": ""
  }
}