{"action":"created","issue":{"url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/165","repository_url":"https://api.github.com/repos/matterport/Mask_RCNN","labels_url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/165/comments","events_url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/165/events","html_url":"https://github.com/matterport/Mask_RCNN/issues/165","id":285251905,"number":165,"title":"TypeError: unsupported operand type(s) for /: 'Tensor' and 'float'","user":{"login":"76176235","id":24861672,"avatar_url":"https://avatars3.githubusercontent.com/u/24861672?v=4","gravatar_id":"","url":"https://api.github.com/users/76176235","html_url":"https://github.com/76176235","followers_url":"https://api.github.com/users/76176235/followers","following_url":"https://api.github.com/users/76176235/following{/other_user}","gists_url":"https://api.github.com/users/76176235/gists{/gist_id}","starred_url":"https://api.github.com/users/76176235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/76176235/subscriptions","organizations_url":"https://api.github.com/users/76176235/orgs","repos_url":"https://api.github.com/users/76176235/repos","events_url":"https://api.github.com/users/76176235/events{/privacy}","received_events_url":"https://api.github.com/users/76176235/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-12-31T10:59:52Z","updated_at":"2018-05-09T02:27:45Z","closed_at":null,"author_association":"NONE","body":"Hi,i am a new to tf and keras.I run Mask_RCNN-2.0 .when i debug the project,i meet a problem.But i dont understand it likeing this:\r\nTraceback (most recent call last):\r\n  File \"/home/whao/pycharm-2017.1.2/helpers/pydev/pydevd.py\", line 1585, in <module>\r\n    globals = debugger.run(setup['file'], None, None, is_module)\r\n  File \"/home/whao/pycharm-2017.1.2/helpers/pydev/pydevd.py\", line 1015, in run\r\n    pydev_imports.execfile(file, globals, locals)  # execute the script\r\n  File \"/home/whao/pycharm-2017.1.2/helpers/pydev/_pydev_imps/_pydev_execfile.py\", line 18, in execfile\r\n    exec(compile(contents+\"\\n\", file, 'exec'), glob, loc)\r\n  File \"/home/whao/Mask_RCNN-2.0/coco.py\", line 382, in <module>\r\n    model_dir=args.logs)\r\n  File \"/home/whao/Mask_RCNN-2.0/model.py\", line 1735, in __init__\r\n    self.keras_model = self.build(mode=mode, config=config)\r\n  File \"/home/whao/Mask_RCNN-2.0/model.py\", line 1875, in build\r\n    target_rois, input_gt_class_ids, gt_boxes, input_gt_masks])\r\n  File \"/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py\", line 603, in __call__\r\n    output = self.call(inputs, **kwargs)\r\n  File \"/home/whao/Mask_RCNN-2.0/model.py\", line 636, in call\r\n    self.config.IMAGES_PER_GPU, names=names)\r\n  File \"/home/whao/Mask_RCNN-2.0/utils.py\", line 673, in batch_slice\r\n    output_slice = graph_fn(*inputs_slice)\r\n  File \"/home/whao/Mask_RCNN-2.0/model.py\", line 635, in <lambda>\r\n    w, x, y, z, self.config),\r\n  File \"/home/whao/Mask_RCNN-2.0/model.py\", line 531, in detection_targets_graph\r\n    negative_count = int((positive_count / config.ROI_POSITIVE_RATIO) - positive_count)\r\nTypeError: unsupported operand type(s) for /: 'Tensor' and 'float'\r\n\r\nwhy the int32 of tensor can operand to the float constant:\r\n    positive_count = tf.shape(positive_indices)[0]\r\n    # Negative ROIs. Add enough to maintain positive:negative ratio.\r\n    negative_count = int((positive_count / config.ROI_POSITIVE_RATIO) - positive_count)\r\n\r\nit differs from the first version:\r\n    r = 1.0 / config.ROI_POSITIVE_RATIO\r\n    negative_count = tf.cast(r * tf.cast(positive_count, tf.float32), tf.int32) - positive_count\r\nWhat should i do to be able to do that like Mask_RCNN-2.0?"},"comment":{"url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/comments/387600714","html_url":"https://github.com/matterport/Mask_RCNN/issues/165#issuecomment-387600714","issue_url":"https://api.github.com/repos/matterport/Mask_RCNN/issues/165","id":387600714,"user":{"login":"76176235","id":24861672,"avatar_url":"https://avatars3.githubusercontent.com/u/24861672?v=4","gravatar_id":"","url":"https://api.github.com/users/76176235","html_url":"https://github.com/76176235","followers_url":"https://api.github.com/users/76176235/followers","following_url":"https://api.github.com/users/76176235/following{/other_user}","gists_url":"https://api.github.com/users/76176235/gists{/gist_id}","starred_url":"https://api.github.com/users/76176235/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/76176235/subscriptions","organizations_url":"https://api.github.com/users/76176235/orgs","repos_url":"https://api.github.com/users/76176235/repos","events_url":"https://api.github.com/users/76176235/events{/privacy}","received_events_url":"https://api.github.com/users/76176235/received_events","type":"User","site_admin":false},"created_at":"2018-05-09T02:27:45Z","updated_at":"2018-05-09T02:27:45Z","author_association":"NONE","body":"Now，the version of code is Mask R-CNN 2.1. You can avoid this error ,while you compile Mask R-CNN 1.0 ."}}
{"actor":{"display_login":"76176235"}}