Error when running yolov3 example

118 views
Skip to first unread message

kazeb

unread,
Jan 21, 2023, 4:16:32 AM1/21/23
to User Group for BigDL
Hi all, 
 
I'm trying to train yolov3 on google colab follow example here: https://github.com/intel-analytics/BigDL/tree/main/python/orca/example/learn/tf2/yolov3

However, I encountered an issue: 
```
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: Using a symbolic `tf.Tensor` as a Python `bool` is not allowed: AutoGraph did convert this function. This might indicate you are trying to use an unsupported feature.
```
I guess that this comes from `transform_targets_for_output` function with `@tf.function` decoration. But I don't know what should I change next. 

ENV: 
- Google Colab
- bigdl_orca_spark3-2.3.0b20230120
- Python 3.8.10
- Tensorflow 2.9.2

Can someone help me?
I’m so thankful for your time and your support.

kazeb


Wang, Yang3

unread,
Jan 23, 2023, 11:53:36 AM1/23/23
to kazeb, User Group for BigDL

Hi kazeb,

 

Thank you for reporting this issue.

 

We are currently looking into it and will get back to you.

 

Best,

Yang

--
You received this message because you are subscribed to the Google Groups "User Group for BigDL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigdl-user-gro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bigdl-user-group/36cea488-e3ad-4448-a5eb-23056cdf58b0n%40googlegroups.com.

Wang, Yang3

unread,
Jan 23, 2023, 3:03:42 PM1/23/23
to Wang, Yang3, kazeb, User Group for BigDL

Hi kazeb,

 

I have tried it on colab and it seems working.

 

https://colab.research.google.com/drive/14cE5fdwPsvLfSIoT7SwCUAyKgprr_oJ7?usp=sharing (I stopped the training process because it takes some time to finish.)

 

Is it possible to share your notebook, so that we can diagnose the problem.

 

Thanks,

Yang

Wang, Yang3

unread,
Jan 24, 2023, 1:50:20 PM1/24/23
to kazeb, User Group for BigDL

Hi Kazeb,

 

Glad it worked.

 

For your notebook, while we are still trying to figure out the root cause of the problem, I did find a workaround:

 

You can move the “transform_targets_for_output” function definition to a file (e.g. functions.py)

 

And then import it in the from the notebook cell.

 

 

I also created a github issue to track the progress (https://github.com/intel-analytics/BigDL/issues/7349).

 

Thank you again for reporting the issue.

 

Yang

 

 

To: Wang, Yang3 yang3...@intel.com
Subject: Tin nhắn riêng tư về: [bigdl-user-group] Error when running yolov3 example

 

Hi Yang, 

I tried your approach and It worked. 
--------------------------------------------------------
Here is my notebook that encountered the issue before: https://colab.research.google.com/drive/1Us_3x2qvGJp9QPE0T-R4rGyDzs_mjBnN?usp=sharing
Instead of using VOC2009 data and `write_parquet` function in your example, I used my data and wrote it to parquet file. Here is the data: https://drive.google.com/drive/folders/1HiogpI2BO_IQZK27RHmORJ023nPsMeJL?usp=sharing

--------------------------------------------------------

Thank you for your time and your support,

kazeb

kazeb

unread,
Jan 31, 2023, 2:12:41 AM1/31/23
to User Group for BigDL
Thank you very much

Vào lúc 01:50:20 UTC+7 ngày Thứ Tư, 25 tháng 1, 2023, Yang Wang đã viết:

kazeb

unread,
May 1, 2023, 6:02:35 AM5/1/23
to User Group for BigDL
Hi Yang, 
I'm building a model for license plate detection. After training, I try to predict an image. However, It doesn't work. 
I guess this comes from the input data when training model. 

Could you please confirm the format of label value in parse_data_train function for me?
My current format: [[ x_min, y_min, x_max, y_max, class ]]
Example: [ [0.3625 , 0.6944444 , 0.56319445, 0.76203704, 0. ] ]

Here is the source code in case you need it.
My running command: `python prediction.py`

Vào lúc 14:12:41 UTC+7 ngày Thứ Ba, 31 tháng 1, 2023, kazeb đã viết:

Wang, Yang3

unread,
May 1, 2023, 1:36:42 PM5/1/23
to kazeb, User Group for BigDL

Hi kazeb,

 

The format is indeed the same as the label value format of the `parse_data_train` function.

kazeb

unread,
May 2, 2023, 12:09:16 PM5/2/23
to User Group for BigDL
Hi Yang, 
Thank you for confirming. 
I tried running the example with epoch = 2 and attempted to predict the cat with weights from `yolov3_train_2.tf`, but it did not work. 
Now, I am going to run the example with epoch = 20. 
I was wondering, how many epochs did you train the model on to achieve the successful detection of the cat in the image as shown in your example?

Vào lúc 00:36:42 UTC+7 ngày Thứ Ba, 2 tháng 5, 2023, Yang Wang đã viết:

Wang, Yang3

unread,
May 3, 2023, 11:33:27 PM5/3/23
to kazeb, User Group for BigDL

Hi Kazeb,

 

We used the default parameter specific the training script, which is 2 epochs.

 

I think it is easier to detect cat images because this task is more similar the pretraining task. Detecting license plate could be harder so I think it makes sense that it needs more epochs.

kazeb

unread,
May 7, 2023, 9:29:42 PM5/7/23
to User Group for BigDL
Thank Yang

Vào lúc 10:33:27 UTC+7 ngày Thứ Năm, 4 tháng 5, 2023, Yang Wang đã viết:
Reply all
Reply to author
Forward
0 new messages