{"action":"created","issue":{"url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/107","repository_url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark","labels_url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/107/comments","events_url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/107/events","html_url":"https://github.com/facebookresearch/maskrcnn-benchmark/pull/107","id":377124225,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MTU5Mzcx","number":107,"title":"Fix repeatedly invoke build_detection_model error.","user":{"login":"GuoxiaWang","id":16953187,"node_id":"MDQ6VXNlcjE2OTUzMTg3","avatar_url":"https://avatars3.githubusercontent.com/u/16953187?v=4","gravatar_id":"","url":"https://api.github.com/users/GuoxiaWang","html_url":"https://github.com/GuoxiaWang","followers_url":"https://api.github.com/users/GuoxiaWang/followers","following_url":"https://api.github.com/users/GuoxiaWang/following{/other_user}","gists_url":"https://api.github.com/users/GuoxiaWang/gists{/gist_id}","starred_url":"https://api.github.com/users/GuoxiaWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuoxiaWang/subscriptions","organizations_url":"https://api.github.com/users/GuoxiaWang/orgs","repos_url":"https://api.github.com/users/GuoxiaWang/repos","events_url":"https://api.github.com/users/GuoxiaWang/events{/privacy}","received_events_url":"https://api.github.com/users/GuoxiaWang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-04T05:56:45Z","updated_at":"2018-11-04T05:56:53Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/pulls/107","html_url":"https://github.com/facebookresearch/maskrcnn-benchmark/pull/107","diff_url":"https://github.com/facebookresearch/maskrcnn-benchmark/pull/107.diff","patch_url":"https://github.com/facebookresearch/maskrcnn-benchmark/pull/107.patch"},"body":"## Bug\r\nWhen I repeatedly invoke build_detection_model function to build the model, I will get the error: `AttributeError: 'ResNet' object has no attribute 'layer1'`. \r\n\r\n## To Reproduce\r\n```\r\nmodel = build_detection_model(cfg)\r\nmodel = build_detection_model(cfg)\r\n```\r\n\r\n## The reason\r\nThe variable `ResNet50StagesTo4` is a global generator expression, so when we build the model secondly, the code executes to Line 82 `for stage_spec in stage_specs:` and `stage_specs` will return empty leading to do not add any stage. Finally, `self._freeze_backbone` try to freeze the backbone by executing `m = getattr(self, \"layer\" + str(stage_index))` firstly. At the moment, it will throw the AttributeError `AttributeError: 'ResNet' object has no attribute 'layer1'`.\r\n\r\nI guess you want to define ResNet50StagesTo4 as the tuple, so I try to fix by add tuple type qualifier.\r\n\r\n## The solution\r\nAdd the tuple type to `ResNet50StagesTo5`, `ResNet50StagesTo4`, `ResNet50FPNStagesTo5`, `ResNet101FPNStagesTo5`.\r\n\r\nI do not know whether there are similar bugs existing, so you need to review my solution. Thank you!"},"comment":{"url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/comments/435644463","html_url":"https://github.com/facebookresearch/maskrcnn-benchmark/pull/107#issuecomment-435644463","issue_url":"https://api.github.com/repos/facebookresearch/maskrcnn-benchmark/issues/107","id":435644463,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTY0NDQ2Mw==","user":{"login":"facebook-github-bot","id":6422482,"node_id":"MDQ6VXNlcjY0MjI0ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/6422482?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook-github-bot","html_url":"https://github.com/facebook-github-bot","followers_url":"https://api.github.com/users/facebook-github-bot/followers","following_url":"https://api.github.com/users/facebook-github-bot/following{/other_user}","gists_url":"https://api.github.com/users/facebook-github-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook-github-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook-github-bot/subscriptions","organizations_url":"https://api.github.com/users/facebook-github-bot/orgs","repos_url":"https://api.github.com/users/facebook-github-bot/repos","events_url":"https://api.github.com/users/facebook-github-bot/events{/privacy}","received_events_url":"https://api.github.com/users/facebook-github-bot/received_events","type":"User","site_admin":false},"created_at":"2018-11-04T05:56:53Z","updated_at":"2018-11-04T05:56:53Z","author_association":"NONE","body":"Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. **If you are contributing on behalf of someone else (eg your employer)**, the individual CLA may not be sufficient and your employer may need the corporate CLA signed.\n\nIf you have received this in error or have any questions, please contact us at [cla@fb.com](mailto:cla@fb.com?subject=CLA%20for%20facebookresearch%2Fmaskrcnn-benchmark%20%23107). Thanks!"}}
{"actor":{"display_login":"facebook-github-bot"}}