643bd0823c1f09fcb621207f3345879abf694ab0,demo.py,,main,#,85

Before Change


            print("prediction done!")

            red_mask = np.zeros((img_shape+(3,)))
            red_mask[:, :] = (0, 0, 255)

            // print(image.shape)
            // image = (image * (1 - display_mask) + red_mask * display_mask).astype(np.uint8)
            image = prediction

After Change



            dismap = np.expand_dims(dismap, axis=-1)

            image = image[:, :, ::-1] // change to rgb
            merge_input = np.concatenate((image, dismap), axis=2).astype(np.float32)
            inputs = torch.from_numpy(merge_input.transpose((2, 0, 1))[np.newaxis, ...])

            // Run a forward pass
            inputs = inputs.to(device)
            outputs = net.forward(inputs)
            outputs = upsample(outputs, size=(450, 450), mode="bilinear", align_corners=True)
            outputs = outputs.to(torch.device("cpu"))

            prediction = np.transpose(outputs.data.numpy()[0, ...], (1, 2, 0))
            prediction = 1 / (1 + np.exp(-prediction))
            prediction = np.squeeze(prediction)
            prediction[prediction>0.8] = 255
            prediction[prediction<=0.8] = 0
            print("prediction done!")
            prediction = np.expand_dims(prediction, axis=-1).astype(np.uint8)
            image = image[:, :, ::-1] // change to bgr
            display_mask = np.concatenate([prediction, prediction, prediction], axis=-1)
            image = cv2.addWeighted(image, 0.9, display_mask, 0.5, 0.1)

        if k == 99:
            break
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: jfzhang95/DeepGrabCut-PyTorch
Commit Name: 643bd0823c1f09fcb621207f3345879abf694ab0
Time: 2018-05-28
Author: jessezhjf@gmail.com
File Name: demo.py
Class Name:
Method Name: main


Project Name: Microsoft/nni
Commit Name: 89fa23cb77746d36b4f1ff6cd4fcefbab18c7d70
Time: 2020-06-11
Author: 38930155+chicm-ms@users.noreply.github.com
File Name: src/sdk/pynni/tests/test_compressor.py
Class Name: CompressorTestCase
Method Name: test_torch_l1filter_pruner


Project Name: aws/sagemaker-python-sdk
Commit Name: 61db445481f516b0d3b21ccfde890fd2b5c34877
Time: 2019-08-13
Author: chuyangdeng@gmail.com
File Name: tests/integ/test_mxnet_train.py
Class Name:
Method Name: test_deploy_model