# Edit dpu\_resnet50

**URL:** <https://discuss.pynq.io/t/edit-dpu-resnet50/2499>\
**Category:** Support\
**Created:** [April 2, 2021, 10:29am UTC](https://discuss.pynq.io/t/edit-dpu-resnet50/2499 "2021-04-02T10:29:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gwyc](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@Gwyc](https://discuss.pynq.io/u/Gwyc)\
**Post date:** [April 2, 2021, 10:29am UTC](https://discuss.pynq.io/t/edit-dpu-resnet50/2499/1 "2021-04-02T10:29:02Z")

</div>

Hi everyone

I’m currently trying to edit [this notebook](https://github.com/Xilinx/DPU-PYNQ/blob/master/pynq_dpu/edge/notebooks/dpu_resnet50.ipynb).

I didn’t edit anything except the 8th cell. I would like to print something if the image shows a certain animal.

```
def run(image_index, display=False):
    preprocessed = preprocess_fn(cv2.imread(
        os.path.join(image_folder, original_images[image_index])))
    image[0,...] = preprocessed.reshape(shapeIn[1:])
    job_id = dpu.execute_async(input_data, output_data)
    dpu.wait(job_id)
    temp = [j.reshape(1, outputSize) for j in output_data]
    softmax = calculate_softmax(temp[0][0])
    if display:
        display_image = cv2.imread(os.path.join(
            image_folder, original_images[image_index]))
        _, ax = plt.subplots(1)
        _ = ax.imshow(cv2.cvtColor(display_image, cv2.COLOR_BGR2RGB))
        #print("Classification: {}".format(predict_label(softmax)))
        #print(f"{softmax}, {predict_label(softmax)}")
        print(type(predict_label(softmax)))
        temp_variable = predict_label(softmax)
        if temp_variable == "Arctic fox, white fox, Alopex lagopus":
            print("hey")
        elif predict_label(softmax) == "Arctic fox, white fox, Alopex lagopus":
            print("It definitely should work")
        else:
            print(f"{temp_variable} is the temporary variable")
            print(f"{predict_label(softmax)} should be in the temporary variable")
            print("error")
            
        print("hello_world")
        temp_variable2 = "this temp variable"
        print(type(temp_variable2))
        if temp_variable2 == "this temp variable":
            print("It should work")

```

I added a couple of tests to see whether or not I was going in the right direction.

I got this:

```
<class 'str'>
Arctic fox, white fox, Alopex lagopus
 is the temporary variable
Arctic fox, white fox, Alopex lagopus

error
hello_world
<class 'str'>
It should work

```

I thought that since `predict_label(softmax)` returns a variable I could use it in a conditional statement. What is wrong in my code?

Thanks in advance for your answer.

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [April 5, 2021, 3:13pm UTC](https://discuss.pynq.io/t/edit-dpu-resnet50/2499/2 "2021-04-05T15:13:34Z")

</div>

Make sure whether the returned string has a line ending ‘\n’

---

<div class="post-metadata">

**Author:** ![Gwyc](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@Gwyc](https://discuss.pynq.io/u/Gwyc)\
**Post date:** [April 6, 2021, 1:32pm UTC](https://discuss.pynq.io/t/edit-dpu-resnet50/2499/3 "2021-04-06T13:32:39Z")

</div>

Hi

Why did you mention “\n”?

This function returns something from [this file](https://github.com/Xilinx/DPU-PYNQ/blob/2c890ccf7cb09da283133a67d82fe40dafa92aa5/pynq_dpu/edge/notebooks/img/words.txt).
