Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, how do I change the dimensions of the output structure, #12639

Closed
1 task done
yuqilol opened this issue Jan 16, 2024 · 14 comments
Closed
1 task done

Hello, how do I change the dimensions of the output structure, #12639

yuqilol opened this issue Jan 16, 2024 · 14 comments
Labels
question Further information is requested Stale

Comments

@yuqilol
Copy link

yuqilol commented Jan 16, 2024

Search before asking

Question

Our project needs to be deployed on Android, so we converted to a tflite model, but the interface of the tflite task library only accepts 2D or 4D output structure, how can I change my model? At present, I have tried two schemes. First, I can change the output structure in detect, train the output for 4d, and then convert it. However, I failed to convert it, and there were many errors. The second is to add a reshape operator to the end of the yaml file of the model, but I don't know how to write this reshape operator and will always report an error.

Additional

class reshape_output(nn.Module):
# Concatenate a list of tensors along dimension
def init(self, c1,c2):
super().init()
def forward(self, x):
return torch.unsqueeze(x,-1)

@yuqilol yuqilol added the question Further information is requested label Jan 16, 2024
Copy link
Contributor

👋 Hello @yuqilol, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics

@glenn-jocher
Copy link
Member

@yuqilol hello! It's great to see you're working on deploying YOLOv5 on Android. To modify the output structure for TFLite compatibility, you can indeed add a reshape operation at the end of your model. However, the code snippet you provided seems incomplete.

For a reshape operation in PyTorch, you would typically use x.view() or torch.reshape(). If you want to add a reshape layer to your model, you can define it like this:

class ReshapeOutput(nn.Module):
    def __init__(self, *shape):
        super().__init__()
        self.shape = shape

    def forward(self, x):
        return x.view(-1, *self.shape)  # or torch.reshape(x, (-1, *self.shape))

You can then instantiate this layer with the desired output shape and add it to your model's .yaml file. Make sure the shape you specify matches the expected output dimensions for TFLite.

If you encounter any errors, please provide the specific error messages, and we can troubleshoot further. For more detailed guidance, you can refer to our documentation at https://docs.ultralytics.com/yolov5/.

Keep in mind that changing the model's architecture might require retraining for optimal performance. Good luck with your deployment! 🚀

@yuqilol
Copy link
Author

yuqilol commented Jan 17, 2024

Hello, I used your structure, but when I used summary to view the structure, the following error occurred. I guess it was a mistake in my yaml file. The error is as follows:
models\yolo: cfg=yolov5s.yaml, batch_size=1, device=, profile=False, line_profile=False, test=False
YOLOv5 2024-1-9 Python-3.8.18 torch-2.1.2+cpu CPU

             from  n    params  module                                  arguments                     

0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 18816 models.common.C3 [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 2 115712 models.common.C3 [128, 128, 2]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 3 625152 models.common.C3 [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 1182720 models.common.C3 [512, 512, 1]
9 -1 1 656896 models.common.SPPF [512, 512, 5]
10 -1 1 131584 models.common.Conv [512, 256, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 361984 models.common.C3 [512, 256, 1, False]
14 -1 1 33024 models.common.Conv [256, 128, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 90880 models.common.C3 [256, 128, 1, False]
18 -1 1 147712 models.common.Conv [128, 128, 3, 2]
19 [-1, 14] 1 0 models.common.Concat [1]
20 -1 1 296448 models.common.C3 [256, 256, 1, False]
21 -1 1 590336 models.common.Conv [256, 256, 3, 2]
22 [-1, 10] 1 0 models.common.Concat [1]
23 -1 1 1182720 models.common.C3 [512, 512, 1, False]
24 [17, 20, 23] 1 229245 Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
25 -1 1 0 models.common.ReshapeOutput [512, 8]
YOLOv5s summary: 215 layers, 7235389 parameters, 7235389 gradients

Fusing layers...
YOLOv5s summary: 158 layers, 7225885 parameters, 7225885 gradients
Traceback (most recent call last):
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torchsummary\torchsummary.py", line 140, in summary
_ = model.to(device)(*x, *args, **kwargs) # type: ignore[misc]
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "F:\down_project\yolov5-master\yolov5-master\models\yolo.py", line 245, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "F:\down_project\yolov5-master\yolov5-master\models\yolo.py", line 156, in _forward_once
x = m(x) # run
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1568, in _call_impl
result = forward_call(*args, **kwargs)
File "F:\down_project\yolov5-master\yolov5-master\models\yolo.py", line 100, in forward
self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i)
File "F:\down_project\yolov5-master\yolov5-master\models\yolo.py", line 123, in _make_grid
anchor_grid = (self.anchors[i] * self.stride[i]).view((1, self.na, 1, 1, 2)).expand(shape)
TypeError: 'NoneType' object is not subscriptable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "F:\down_project\yolov5-master\yolov5-master\models\yolo.py", line 457, in
summary(model,(3,640,640))
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torchsummary\torchsummary.py", line 143, in summary
raise RuntimeError(
RuntimeError: Failed to run torchsummary. See above stack traces for more details. Executed layers up to: [Conv: 2-1, Conv2d: 3-1, SiLU: 3-2, SiLU: 3-3, SiLU: 4-1, SiLU: 4-2, SiLU: 4-3, SiLU: 3-4, SiLU: 4-4, SiLU: 4-5, SiLU: 4-6, SiLU: 3-5, SiLU: 4-7, SiLU: 4-8, SiLU: 4-9, SiLU: 3-6, SiLU: 4-10, SiLU: 4-11, SiLU: 4-12, SiLU: 4-13, SiLU: 4-14, SiLU: 3-7, SiLU: 4-15, SiLU: 4-16, SiLU: 4-17, SiLU: 3-8, SiLU: 4-18, SiLU: 4-19, SiLU: 4-20, SiLU: 3-9, SiLU: 4-21, SiLU: 4-22, SiLU: 4-23, SiLU: 3-10, SiLU: 4-24, SiLU: 4-25, SiLU: 4-26, Conv: 2-2, Conv2d: 3-11, SiLU: 3-12, SiLU: 3-13, SiLU: 4-27, SiLU: 4-28, SiLU: 4-29, SiLU: 3-14, SiLU: 4-30, SiLU: 4-31, SiLU: 4-32, SiLU: 3-15, SiLU: 4-33, SiLU: 4-34, SiLU: 4-35, SiLU: 3-16, SiLU: 4-36, SiLU: 4-37, SiLU: 4-38, SiLU: 4-39, SiLU: 4-40, SiLU: 3-17, SiLU: 4-41, SiLU: 4-42, SiLU: 4-43, SiLU: 3-18, SiLU: 4-44, SiLU: 4-45, SiLU: 4-46, SiLU: 3-19, SiLU: 4-47, SiLU: 4-48, SiLU: 4-49, SiLU: 3-20, SiLU: 4-50, SiLU: 4-51, SiLU: 4-52, C3: 2-3, Conv: 3-21, Conv2d: 4-53, SiLU: 3-22, SiLU: 3-23, SiLU: 4-54, SiLU: 4-55, SiLU: 4-56, SiLU: 3-24, SiLU: 4-57, SiLU: 4-58, SiLU: 4-59, SiLU: 3-25, SiLU: 4-60, SiLU: 4-61, SiLU: 4-62, SiLU: 3-26, SiLU: 4-63, SiLU: 4-64, SiLU: 4-65, SiLU: 4-66, SiLU: 4-67, SiLU: 3-27, SiLU: 4-68, SiLU: 4-69, SiLU: 4-70, SiLU: 3-28, SiLU: 4-71, SiLU: 4-72, SiLU: 4-73, SiLU: 3-29, SiLU: 4-74, SiLU: 4-75, SiLU: 4-76, SiLU: 3-30, SiLU: 4-77, SiLU: 4-78, SiLU: 4-79, Sequential: 3-31, Bottleneck: 4-80, SiLU: 3-32, SiLU: 3-33, SiLU: 4-81, SiLU: 4-82, SiLU: 4-83, SiLU: 3-34, SiLU: 4-84, SiLU: 4-85, SiLU: 4-86, SiLU: 3-35, SiLU: 4-87, SiLU: 4-88, SiLU: 4-89, SiLU: 3-36, SiLU: 4-90, SiLU: 4-91, SiLU: 4-92, SiLU: 4-93, SiLU: 4-94, SiLU: 3-37, SiLU: 4-95, SiLU: 4-96, SiLU: 4-97, SiLU: 3-38, SiLU: 4-98, SiLU: 4-99, SiLU: 4-100, SiLU: 3-39, SiLU: 4-101, SiLU: 4-102, SiLU: 4-103, SiLU: 3-40, SiLU: 4-104, SiLU: 4-105, SiLU: 4-106, SiLU: 3-41, SiLU: 3-42, SiLU: 4-107, SiLU: 4-108, SiLU: 4-109, SiLU: 3-43, SiLU: 4-110, SiLU: 4-111, SiLU: 4-112, SiLU: 3-44, SiLU: 4-113, SiLU: 4-114, SiLU: 4-115, SiLU: 3-45, SiLU: 4-116, SiLU: 4-117, SiLU: 4-118, SiLU: 4-119, SiLU: 4-120, SiLU: 3-46, SiLU: 4-121, SiLU: 4-122, SiLU: 4-123, SiLU: 3-47, SiLU: 4-124, SiLU: 4-125, SiLU: 4-126, SiLU: 3-48, SiLU: 4-127, SiLU: 4-128, SiLU: 4-129, SiLU: 3-49, SiLU: 4-130, SiLU: 4-131, SiLU: 4-132, Conv: 3-50, Conv2d: 4-133, SiLU: 3-51, SiLU: 3-52, SiLU: 4-134, SiLU: 4-135, SiLU: 4-136, SiLU: 3-53, SiLU: 4-137, SiLU: 4-138, SiLU: 4-139, SiLU: 3-54, SiLU: 4-140, SiLU: 4-141, SiLU: 4-142, SiLU: 3-55, SiLU: 4-143, SiLU: 4-144, SiLU: 4-145, SiLU: 4-146, SiLU: 4-147, SiLU: 3-56, SiLU: 4-148, SiLU: 4-149, SiLU: 4-150, SiLU: 3-57, SiLU: 4-151, SiLU: 4-152, SiLU: 4-153, SiLU: 3-58, SiLU: 4-154, SiLU: 4-155, SiLU: 4-156, SiLU: 3-59, SiLU: 4-157, SiLU: 4-158, SiLU: 4-159, Conv: 3-60, Conv2d: 4-160, SiLU: 3-61, SiLU: 3-62, SiLU: 4-161, SiLU: 4-162, SiLU: 4-163, SiLU: 3-63, SiLU: 4-164, SiLU: 4-165, SiLU: 4-166, SiLU: 3-64, SiLU: 4-167, SiLU: 4-168, SiLU: 4-169, SiLU: 3-65, SiLU: 4-170, SiLU: 4-171, SiLU: 4-172, SiLU: 4-173, SiLU: 4-174, SiLU: 3-66, SiLU: 4-175, SiLU: 4-176, SiLU: 4-177, SiLU: 3-67, SiLU: 4-178, SiLU: 4-179, SiLU: 4-180, SiLU: 3-68, SiLU: 4-181, SiLU: 4-182, SiLU: 4-183, SiLU: 3-69, SiLU: 4-184, SiLU: 4-185, SiLU: 4-186, Conv: 2-4, Conv2d: 3-70, SiLU: 3-71, SiLU: 3-72, SiLU: 4-187, SiLU: 4-188, SiLU: 4-189, SiLU: 3-73, SiLU: 4-190, SiLU: 4-191, SiLU: 4-192, SiLU: 3-74, SiLU: 4-193, SiLU: 4-194, SiLU: 4-195, SiLU: 3-75, SiLU: 4-196, SiLU: 4-197, SiLU: 4-198, SiLU: 4-199, SiLU: 4-200, SiLU: 3-76, SiLU: 4-201, SiLU: 4-202, SiLU: 4-203, SiLU: 3-77, SiLU: 4-204, SiLU: 4-205, SiLU: 4-206, SiLU: 3-78, SiLU: 4-207, SiLU: 4-208, SiLU: 4-209, SiLU: 3-79, SiLU: 4-210, SiLU: 4-211, SiLU: 4-212, C3: 2-5, Conv: 3-80, Conv2d: 4-213, SiLU: 3-81, SiLU: 3-82, SiLU: 4-214, SiLU: 4-215, SiLU: 4-216, SiLU: 3-83, SiLU: 4-217, SiLU: 4-218, SiLU: 4-219, SiLU: 3-84, SiLU: 4-220, SiLU: 4-221, SiLU: 4-222, SiLU: 3-85, SiLU: 4-223, SiLU: 4-224, SiLU: 4-225, SiLU: 4-226, SiLU: 4-227, SiLU: 3-86, SiLU: 4-228, SiLU: 4-229, SiLU: 4-230, SiLU: 3-87, SiLU: 4-231, SiLU: 4-232, SiLU: 4-233, SiLU: 3-88, SiLU: 4-234, SiLU: 4-235, SiLU: 4-236, SiLU: 3-89, SiLU: 4-237, SiLU: 4-238, SiLU: 4-239, Sequential: 3-90, Bottleneck: 4-240, SiLU: 3-91, SiLU: 3-92, SiLU: 4-241, SiLU: 4-242, SiLU: 4-243, SiLU: 3-93, SiLU: 4-244, SiLU: 4-245, SiLU: 4-246, SiLU: 3-94, SiLU: 4-247, SiLU: 4-248, SiLU: 4-249, SiLU: 3-95, SiLU: 4-250, SiLU: 4-251, SiLU: 4-252, SiLU: 4-253, SiLU: 4-254, SiLU: 3-96, SiLU: 4-255, SiLU: 4-256, SiLU: 4-257, SiLU: 3-97, SiLU: 4-258, SiLU: 4-259, SiLU: 4-260, SiLU: 3-98, SiLU: 4-261, SiLU: 4-262, SiLU: 4-263, SiLU: 3-99, SiLU: 4-264, SiLU: 4-265, SiLU: 4-266, SiLU: 3-100, SiLU: 3-101, SiLU: 4-267, SiLU: 4-268, SiLU: 4-269, SiLU: 3-102, SiLU: 4-270, SiLU: 4-271, SiLU: 4-272, SiLU: 3-103, SiLU: 4-273, SiLU: 4-274, SiLU: 4-275, SiLU: 3-104, SiLU: 4-276, SiLU: 4-277, SiLU: 4-278, SiLU: 4-279, SiLU: 4-280, SiLU: 3-105, SiLU: 4-281, SiLU: 4-282, SiLU: 4-283, SiLU: 3-106, SiLU: 4-284, SiLU: 4-285, SiLU: 4-286, SiLU: 3-107, SiLU: 4-287, SiLU: 4-288, SiLU: 4-289, SiLU: 3-108, SiLU: 4-290, SiLU: 4-291, SiLU: 4-292, Bottleneck: 4-293, SiLU: 3-109, SiLU: 3-110, SiLU: 4-294, SiLU: 4-295, SiLU: 4-296, SiLU: 3-111, SiLU: 4-297, SiLU: 4-298, SiLU: 4-299, SiLU: 3-112, SiLU: 4-300, SiLU: 4-301, SiLU: 4-302, SiLU: 3-113, SiLU: 4-303, SiLU: 4-304, SiLU: 4-305, SiLU: 4-306, SiLU: 4-307, SiLU: 3-114, SiLU: 4-308, SiLU: 4-309, SiLU: 4-310, SiLU: 3-115, SiLU: 4-311, SiLU: 4-312, SiLU: 4-313, SiLU: 3-116, SiLU: 4-314, SiLU: 4-315, SiLU: 4-316, SiLU: 3-117, SiLU: 4-317, SiLU: 4-318, SiLU: 4-319, SiLU: 3-118, SiLU: 3-119, SiLU: 4-320, SiLU: 4-321, SiLU: 4-322, SiLU: 3-120, SiLU: 4-323, SiLU: 4-324, SiLU: 4-325, SiLU: 3-121, SiLU: 4-326, SiLU: 4-327, SiLU: 4-328, SiLU: 3-122, SiLU: 4-329, SiLU: 4-330, SiLU: 4-331, SiLU: 4-332, SiLU: 4-333, SiLU: 3-123, SiLU: 4-334, SiLU: 4-335, SiLU: 4-336, SiLU: 3-124, SiLU: 4-337, SiLU: 4-338, SiLU: 4-339, SiLU: 3-125, SiLU: 4-340, SiLU: 4-341, SiLU: 4-342, SiLU: 3-126, SiLU: 4-343, SiLU: 4-344, SiLU: 4-345, Conv: 3-127, Conv2d: 4-346, SiLU: 3-128, SiLU: 3-129, SiLU: 4-347, SiLU: 4-348, SiLU: 4-349, SiLU: 3-130, SiLU: 4-350, SiLU: 4-351, SiLU: 4-352, SiLU: 3-131, SiLU: 4-353, SiLU: 4-354, SiLU: 4-355, SiLU: 3-132, SiLU: 4-356, SiLU: 4-357, SiLU: 4-358, SiLU: 4-359, SiLU: 4-360, SiLU: 3-133, SiLU: 4-361, SiLU: 4-362, SiLU: 4-363, SiLU: 3-134, SiLU: 4-364, SiLU: 4-365, SiLU: 4-366, SiLU: 3-135, SiLU: 4-367, SiLU: 4-368, SiLU: 4-369, SiLU: 3-136, SiLU: 4-370, SiLU: 4-371, SiLU: 4-372, Conv: 3-137, Conv2d: 4-373, SiLU: 3-138, SiLU: 3-139, SiLU: 4-374, SiLU: 4-375, SiLU: 4-376, SiLU: 3-140, SiLU: 4-377, SiLU: 4-378, SiLU: 4-379, SiLU: 3-141, SiLU: 4-380, SiLU: 4-381, SiLU: 4-382, SiLU: 3-142, SiLU: 4-383, SiLU: 4-384, SiLU: 4-385, SiLU: 4-386, SiLU: 4-387, SiLU: 3-143, SiLU: 4-388, SiLU: 4-389, SiLU: 4-390, SiLU: 3-144, SiLU: 4-391, SiLU: 4-392, SiLU: 4-393, SiLU: 3-145, SiLU: 4-394, SiLU: 4-395, SiLU: 4-396, SiLU: 3-146, SiLU: 4-397, SiLU: 4-398, SiLU: 4-399, Conv: 2-6, Conv2d: 3-147, SiLU: 3-148, SiLU: 3-149, SiLU: 4-400, SiLU: 4-401, SiLU: 4-402, SiLU: 3-150, SiLU: 4-403, SiLU: 4-404, SiLU: 4-405, SiLU: 3-151, SiLU: 4-406, SiLU: 4-407, SiLU: 4-408, SiLU: 3-152, SiLU: 4-409, SiLU: 4-410, SiLU: 4-411, SiLU: 4-412, SiLU: 4-413, SiLU: 3-153, SiLU: 4-414, SiLU: 4-415, SiLU: 4-416, SiLU: 3-154, SiLU: 4-417, SiLU: 4-418, SiLU: 4-419, SiLU: 3-155, SiLU: 4-420, SiLU: 4-421, SiLU: 4-422, SiLU: 3-156, SiLU: 4-423, SiLU: 4-424, SiLU: 4-425, C3: 2-7, Conv: 3-157, Conv2d: 4-426, SiLU: 3-158, SiLU: 3-159, SiLU: 4-427, SiLU: 4-428, SiLU: 4-429, SiLU: 3-160, SiLU: 4-430, SiLU: 4-431, SiLU: 4-432, SiLU: 3-161, SiLU: 4-433, SiLU: 4-434, SiLU: 4-435, SiLU: 3-162, SiLU: 4-436, SiLU: 4-437, SiLU: 4-438, SiLU: 4-439, SiLU: 4-440, SiLU: 3-163, SiLU: 4-441, SiLU: 4-442, SiLU: 4-443, SiLU: 3-164, SiLU: 4-444, SiLU: 4-445, SiLU: 4-446, SiLU: 3-165, SiLU: 4-447, SiLU: 4-448, SiLU: 4-449, SiLU: 3-166, SiLU: 4-450, SiLU: 4-451, SiLU: 4-452, Sequential: 3-167, Bottleneck: 4-453, SiLU: 3-168, SiLU: 3-169, SiLU: 4-454, SiLU: 4-455, SiLU: 4-456, SiLU: 3-170, SiLU: 4-457, SiLU: 4-458, SiLU: 4-459, SiLU: 3-171, SiLU: 4-460, SiLU: 4-461, SiLU: 4-462, SiLU: 3-172, SiLU: 4-463, SiLU: 4-464, SiLU: 4-465, SiLU: 4-466, SiLU: 4-467, SiLU: 3-173, SiLU: 4-468, SiLU: 4-469, SiLU: 4-470, SiLU: 3-174, SiLU: 4-471, SiLU: 4-472, SiLU: 4-473, SiLU: 3-175, SiLU: 4-474, SiLU: 4-475, SiLU: 4-476, SiLU: 3-176, SiLU: 4-477, SiLU: 4-478, SiLU: 4-479, SiLU: 3-177, SiLU: 3-178, SiLU: 4-480, SiLU: 4-481, SiLU: 4-482, SiLU: 3-179, SiLU: 4-483, SiLU: 4-484, SiLU: 4-485, SiLU: 3-180, SiLU: 4-486, SiLU: 4-487, SiLU: 4-488, SiLU: 3-181, SiLU: 4-489, SiLU: 4-490, SiLU: 4-491, SiLU: 4-492, SiLU: 4-493, SiLU: 3-182, SiLU: 4-494, SiLU: 4-495, SiLU: 4-496, SiLU: 3-183, SiLU: 4-497, SiLU: 4-498, SiLU: 4-499, SiLU: 3-184, SiLU: 4-500, SiLU: 4-501, SiLU: 4-502, SiLU: 3-185, SiLU: 4-503, SiLU: 4-504, SiLU: 4-505, Bottleneck: 4-506, SiLU: 3-186, SiLU: 3-187, SiLU: 4-507, SiLU: 4-508, SiLU: 4-509, SiLU: 3-188, SiLU: 4-510, SiLU: 4-511, SiLU: 4-512, SiLU: 3-189, SiLU: 4-513, SiLU: 4-514, SiLU: 4-515, SiLU: 3-190, SiLU: 4-516, SiLU: 4-517, SiLU: 4-518, SiLU: 4-519, SiLU: 4-520, SiLU: 3-191, SiLU: 4-521, SiLU: 4-522, SiLU: 4-523, SiLU: 3-192, SiLU: 4-524, SiLU: 4-525, SiLU: 4-526, SiLU: 3-193, SiLU: 4-527, SiLU: 4-528, SiLU: 4-529, SiLU: 3-194, SiLU: 4-530, SiLU: 4-531, SiLU: 4-532, SiLU: 3-195, SiLU: 3-196, SiLU: 4-533, SiLU: 4-534, SiLU: 4-535, SiLU: 3-197, SiLU: 4-536, SiLU: 4-537, SiLU: 4-538, SiLU: 3-198, SiLU: 4-539, SiLU: 4-540, SiLU: 4-541, SiLU: 3-199, SiLU: 4-542, SiLU: 4-543, SiLU: 4-544, SiLU: 4-545, SiLU: 4-546, SiLU: 3-200, SiLU: 4-547, SiLU: 4-548, SiLU: 4-549, SiLU: 3-201, SiLU: 4-550, SiLU: 4-551, SiLU: 4-552, SiLU: 3-202, SiLU: 4-553, SiLU: 4-554, SiLU: 4-555, SiLU: 3-203, SiLU: 4-556, SiLU: 4-557, SiLU: 4-558, Bottleneck: 4-559, SiLU: 3-204, SiLU: 3-205, SiLU: 4-560, SiLU: 4-561, SiLU: 4-562, SiLU: 3-206, SiLU: 4-563, SiLU: 4-564, SiLU: 4-565, SiLU: 3-207, SiLU: 4-566, SiLU: 4-567, SiLU: 4-568, SiLU: 3-208, SiLU: 4-569, SiLU: 4-570, SiLU: 4-571, SiLU: 4-572, SiLU: 4-573, SiLU: 3-209, SiLU: 4-574, SiLU: 4-575, SiLU: 4-576, SiLU: 3-210, SiLU: 4-577, SiLU: 4-578, SiLU: 4-579, SiLU: 3-211, SiLU: 4-580, SiLU: 4-581, SiLU: 4-582, SiLU: 3-212, SiLU: 4-583, SiLU: 4-584, SiLU: 4-585, SiLU: 3-213, SiLU: 3-214, SiLU: 4-586, SiLU: 4-587, SiLU: 4-588, SiLU: 3-215, SiLU: 4-589, SiLU: 4-590, SiLU: 4-591, SiLU: 3-216, SiLU: 4-592, SiLU: 4-593, SiLU: 4-594, SiLU: 3-217, SiLU: 4-595, SiLU: 4-596, SiLU: 4-597, SiLU: 4-598, SiLU: 4-599, SiLU: 3-218, SiLU: 4-600, SiLU: 4-601, SiLU: 4-602, SiLU: 3-219, SiLU: 4-603, SiLU: 4-604, SiLU: 4-605, SiLU: 3-220, SiLU: 4-606, SiLU: 4-607, SiLU: 4-608, SiLU: 3-221, SiLU: 4-609, SiLU: 4-610, SiLU: 4-611, Conv: 3-222, Conv2d: 4-612, SiLU: 3-223, SiLU: 3-224, SiLU: 4-613, SiLU: 4-614, SiLU: 4-615, SiLU: 3-225, SiLU: 4-616, SiLU: 4-617, SiLU: 4-618, SiLU: 3-226, SiLU: 4-619, SiLU: 4-620, SiLU: 4-621, SiLU: 3-227, SiLU: 4-622, SiLU: 4-623, SiLU: 4-624, SiLU: 4-625, SiLU: 4-626, SiLU: 3-228, SiLU: 4-627, SiLU: 4-628, SiLU: 4-629, SiLU: 3-229, SiLU: 4-630, SiLU: 4-631, SiLU: 4-632, SiLU: 3-230, SiLU: 4-633, SiLU: 4-634, SiLU: 4-635, SiLU: 3-231, SiLU: 4-636, SiLU: 4-637, SiLU: 4-638, Conv: 3-232, Conv2d: 4-639, SiLU: 3-233, SiLU: 3-234, SiLU: 4-640, SiLU: 4-641, SiLU: 4-642, SiLU: 3-235, SiLU: 4-643, SiLU: 4-644, SiLU: 4-645, SiLU: 3-236, SiLU: 4-646, SiLU: 4-647, SiLU: 4-648, SiLU: 3-237, SiLU: 4-649, SiLU: 4-650, SiLU: 4-651, SiLU: 4-652, SiLU: 4-653, SiLU: 3-238, SiLU: 4-654, SiLU: 4-655, SiLU: 4-656, SiLU: 3-239, SiLU: 4-657, SiLU: 4-658, SiLU: 4-659, SiLU: 3-240, SiLU: 4-660, SiLU: 4-661, SiLU: 4-662, SiLU: 3-241, SiLU: 4-663, SiLU: 4-664, SiLU: 4-665, Conv: 2-8, Conv2d: 3-242, SiLU: 3-243, SiLU: 3-244, SiLU: 4-666, SiLU: 4-667, SiLU: 4-668, SiLU: 3-245, SiLU: 4-669, SiLU: 4-670, SiLU: 4-671, SiLU: 3-246, SiLU: 4-672, SiLU: 4-673, SiLU: 4-674, SiLU: 3-247, SiLU: 4-675, SiLU: 4-676, SiLU: 4-677, SiLU: 4-678, SiLU: 4-679, SiLU: 3-248, SiLU: 4-680, SiLU: 4-681, SiLU: 4-682, SiLU: 3-249, SiLU: 4-683, SiLU: 4-684, SiLU: 4-685, SiLU: 3-250, SiLU: 4-686, SiLU: 4-687, SiLU: 4-688, SiLU: 3-251, SiLU: 4-689, SiLU: 4-690, SiLU: 4-691, C3: 2-9, Conv: 3-252, Conv2d: 4-692, SiLU: 3-253, SiLU: 3-254, SiLU: 4-693, SiLU: 4-694, SiLU: 4-695, SiLU: 3-255, SiLU: 4-696, SiLU: 4-697, SiLU: 4-698, SiLU: 3-256, SiLU: 4-699, SiLU: 4-700, SiLU: 4-701, SiLU: 3-257, SiLU: 4-702, SiLU: 4-703, SiLU: 4-704, SiLU: 4-705, SiLU: 4-706, SiLU: 3-258, SiLU: 4-707, SiLU: 4-708, SiLU: 4-709, SiLU: 3-259, SiLU: 4-710, SiLU: 4-711, SiLU: 4-712, SiLU: 3-260, SiLU: 4-713, SiLU: 4-714, SiLU: 4-715, SiLU: 3-261, SiLU: 4-716, SiLU: 4-717, SiLU: 4-718, Sequential: 3-262, Bottleneck: 4-719, SiLU: 3-263, SiLU: 3-264, SiLU: 4-720, SiLU: 4-721, SiLU: 4-722, SiLU: 3-265, SiLU: 4-723, SiLU: 4-724, SiLU: 4-725, SiLU: 3-266, SiLU: 4-726, SiLU: 4-727, SiLU: 4-728, SiLU: 3-267, SiLU: 4-729, SiLU: 4-730, SiLU: 4-731, SiLU: 4-732, SiLU: 4-733, SiLU: 3-268, SiLU: 4-734, SiLU: 4-735, SiLU: 4-736, SiLU: 3-269, SiLU: 4-737, SiLU: 4-738, SiLU: 4-739, SiLU: 3-270, SiLU: 4-740, SiLU: 4-741, SiLU: 4-742, SiLU: 3-271, SiLU: 4-743, SiLU: 4-744, SiLU: 4-745, SiLU: 3-272, SiLU: 3-273, SiLU: 4-746, SiLU: 4-747, SiLU: 4-748, SiLU: 3-274, SiLU: 4-749, SiLU: 4-750, SiLU: 4-751, SiLU: 3-275, SiLU: 4-752, SiLU: 4-753, SiLU: 4-754, SiLU: 3-276, SiLU: 4-755, SiLU: 4-756, SiLU: 4-757, SiLU: 4-758, SiLU: 4-759, SiLU: 3-277, SiLU: 4-760, SiLU: 4-761, SiLU: 4-762, SiLU: 3-278, SiLU: 4-763, SiLU: 4-764, SiLU: 4-765, SiLU: 3-279, SiLU: 4-766, SiLU: 4-767, SiLU: 4-768, SiLU: 3-280, SiLU: 4-769, SiLU: 4-770, SiLU: 4-771, Conv: 3-281, Conv2d: 4-772, SiLU: 3-282, SiLU: 3-283, SiLU: 4-773, SiLU: 4-774, SiLU: 4-775, SiLU: 3-284, SiLU: 4-776, SiLU: 4-777, SiLU: 4-778, SiLU: 3-285, SiLU: 4-779, SiLU: 4-780, SiLU: 4-781, SiLU: 3-286, SiLU: 4-782, SiLU: 4-783, SiLU: 4-784, SiLU: 4-785, SiLU: 4-786, SiLU: 3-287, SiLU: 4-787, SiLU: 4-788, SiLU: 4-789, SiLU: 3-288, SiLU: 4-790, SiLU: 4-791, SiLU: 4-792, SiLU: 3-289, SiLU: 4-793, SiLU: 4-794, SiLU: 4-795, SiLU: 3-290, SiLU: 4-796, SiLU: 4-797, SiLU: 4-798, Conv: 3-291, Conv2d: 4-799, SiLU: 3-292, SiLU: 3-293, SiLU: 4-800, SiLU: 4-801, SiLU: 4-802, SiLU: 3-294, SiLU: 4-803, SiLU: 4-804, SiLU: 4-805, SiLU: 3-295, SiLU: 4-806, SiLU: 4-807, SiLU: 4-808, SiLU: 3-296, SiLU: 4-809, SiLU: 4-810, SiLU: 4-811, SiLU: 4-812, SiLU: 4-813, SiLU: 3-297, SiLU: 4-814, SiLU: 4-815, SiLU: 4-816, SiLU: 3-298, SiLU: 4-817, SiLU: 4-818, SiLU: 4-819, SiLU: 3-299, SiLU: 4-820, SiLU: 4-821, SiLU: 4-822, SiLU: 3-300, SiLU: 4-823, SiLU: 4-824, SiLU: 4-825, SPPF: 2-10, Conv: 3-301, Conv2d: 4-826, SiLU: 3-302, SiLU: 3-303, SiLU: 4-827, SiLU: 4-828, SiLU: 4-829, SiLU: 3-304, SiLU: 4-830, SiLU: 4-831, SiLU: 4-832, SiLU: 3-305, SiLU: 4-833, SiLU: 4-834, SiLU: 4-835, SiLU: 3-306, SiLU: 4-836, SiLU: 4-837, SiLU: 4-838, SiLU: 4-839, SiLU: 4-840, SiLU: 3-307, SiLU: 4-841, SiLU: 4-842, SiLU: 4-843, SiLU: 3-308, SiLU: 4-844, SiLU: 4-845, SiLU: 4-846, SiLU: 3-309, SiLU: 4-847, SiLU: 4-848, SiLU: 4-849, SiLU: 3-310, SiLU: 4-850, SiLU: 4-851, SiLU: 4-852, MaxPool2d: 3-311, MaxPool2d: 3-312, MaxPool2d: 3-313, Conv: 3-314, Conv2d: 4-853, SiLU: 3-315, SiLU: 3-316, SiLU: 4-854, SiLU: 4-855, SiLU: 4-856, SiLU: 3-317, SiLU: 4-857, SiLU: 4-858, SiLU: 4-859, SiLU: 3-318, SiLU: 4-860, SiLU: 4-861, SiLU: 4-862, SiLU: 3-319, SiLU: 4-863, SiLU: 4-864, SiLU: 4-865, SiLU: 4-866, SiLU: 4-867, SiLU: 3-320, SiLU: 4-868, SiLU: 4-869, SiLU: 4-870, SiLU: 3-321, SiLU: 4-871, SiLU: 4-872, SiLU: 4-873, SiLU: 3-322, SiLU: 4-874, SiLU: 4-875, SiLU: 4-876, SiLU: 3-323, SiLU: 4-877, SiLU: 4-878, SiLU: 4-879, Conv: 2-11, Conv2d: 3-324, SiLU: 3-325, SiLU: 3-326, SiLU: 4-880, SiLU: 4-881, SiLU: 4-882, SiLU: 3-327, SiLU: 4-883, SiLU: 4-884, SiLU: 4-885, SiLU: 3-328, SiLU: 4-886, SiLU: 4-887, SiLU: 4-888, SiLU: 3-329, SiLU: 4-889, SiLU: 4-890, SiLU: 4-891, SiLU: 4-892, SiLU: 4-893, SiLU: 3-330, SiLU: 4-894, SiLU: 4-895, SiLU: 4-896, SiLU: 3-331, SiLU: 4-897, SiLU: 4-898, SiLU: 4-899, SiLU: 3-332, SiLU: 4-900, SiLU: 4-901, SiLU: 4-902, SiLU: 3-333, SiLU: 4-903, SiLU: 4-904, SiLU: 4-905, Upsample: 2-12, Concat: 2-13, C3: 2-14, Conv: 3-334, Conv2d: 4-906, SiLU: 3-335, SiLU: 3-336, SiLU: 4-907, SiLU: 4-908, SiLU: 4-909, SiLU: 3-337, SiLU: 4-910, SiLU: 4-911, SiLU: 4-912, SiLU: 3-338, SiLU: 4-913, SiLU: 4-914, SiLU: 4-915, SiLU: 3-339, SiLU: 4-916, SiLU: 4-917, SiLU: 4-918, SiLU: 4-919, SiLU: 4-920, SiLU: 3-340, SiLU: 4-921, SiLU: 4-922, SiLU: 4-923, SiLU: 3-341, SiLU: 4-924, SiLU: 4-925, SiLU: 4-926, SiLU: 3-342, SiLU: 4-927, SiLU: 4-928, SiLU: 4-929, SiLU: 3-343, SiLU: 4-930, SiLU: 4-931, SiLU: 4-932, Sequential: 3-344, Bottleneck: 4-933, SiLU: 3-345, SiLU: 3-346, SiLU: 4-934, SiLU: 4-935, SiLU: 4-936, SiLU: 3-347, SiLU: 4-937, SiLU: 4-938, SiLU: 4-939, SiLU: 3-348, SiLU: 4-940, SiLU: 4-941, SiLU: 4-942, SiLU: 3-349, SiLU: 4-943, SiLU: 4-944, SiLU: 4-945, SiLU: 4-946, SiLU: 4-947, SiLU: 3-350, SiLU: 4-948, SiLU: 4-949, SiLU: 4-950, SiLU: 3-351, SiLU: 4-951, SiLU: 4-952, SiLU: 4-953, SiLU: 3-352, SiLU: 4-954, SiLU: 4-955, SiLU: 4-956, SiLU: 3-353, SiLU: 4-957, SiLU: 4-958, SiLU: 4-959, SiLU: 3-354, SiLU: 3-355, SiLU: 4-960, SiLU: 4-961, SiLU: 4-962, SiLU: 3-356, SiLU: 4-963, SiLU: 4-964, SiLU: 4-965, SiLU: 3-357, SiLU: 4-966, SiLU: 4-967, SiLU: 4-968, SiLU: 3-358, SiLU: 4-969, SiLU: 4-970, SiLU: 4-971, SiLU: 4-972, SiLU: 4-973, SiLU: 3-359, SiLU: 4-974, SiLU: 4-975, SiLU: 4-976, SiLU: 3-360, SiLU: 4-977, SiLU: 4-978, SiLU: 4-979, SiLU: 3-361, SiLU: 4-980, SiLU: 4-981, SiLU: 4-982, SiLU: 3-362, SiLU: 4-983, SiLU: 4-984, SiLU: 4-985, Conv: 3-363, Conv2d: 4-986, SiLU: 3-364, SiLU: 3-365, SiLU: 4-987, SiLU: 4-988, SiLU: 4-989, SiLU: 3-366, SiLU: 4-990, SiLU: 4-991, SiLU: 4-992, SiLU: 3-367, SiLU: 4-993, SiLU: 4-994, SiLU: 4-995, SiLU: 3-368, SiLU: 4-996, SiLU: 4-997, SiLU: 4-998, SiLU: 4-999, SiLU: 4-1000, SiLU: 3-369, SiLU: 4-1001, SiLU: 4-1002, SiLU: 4-1003, SiLU: 3-370, SiLU: 4-1004, SiLU: 4-1005, SiLU: 4-1006, SiLU: 3-371, SiLU: 4-1007, SiLU: 4-1008, SiLU: 4-1009, SiLU: 3-372, SiLU: 4-1010, SiLU: 4-1011, SiLU: 4-1012, Conv: 3-373, Conv2d: 4-1013, SiLU: 3-374, SiLU: 3-375, SiLU: 4-1014, SiLU: 4-1015, SiLU: 4-1016, SiLU: 3-376, SiLU: 4-1017, SiLU: 4-1018, SiLU: 4-1019, SiLU: 3-377, SiLU: 4-1020, SiLU: 4-1021, SiLU: 4-1022, SiLU: 3-378, SiLU: 4-1023, SiLU: 4-1024, SiLU: 4-1025, SiLU: 4-1026, SiLU: 4-1027, SiLU: 3-379, SiLU: 4-1028, SiLU: 4-1029, SiLU: 4-1030, SiLU: 3-380, SiLU: 4-1031, SiLU: 4-1032, SiLU: 4-1033, SiLU: 3-381, SiLU: 4-1034, SiLU: 4-1035, SiLU: 4-1036, SiLU: 3-382, SiLU: 4-1037, SiLU: 4-1038, SiLU: 4-1039, Conv: 2-15, Conv2d: 3-383, SiLU: 3-384, SiLU: 3-385, SiLU: 4-1040, SiLU: 4-1041, SiLU: 4-1042, SiLU: 3-386, SiLU: 4-1043, SiLU: 4-1044, SiLU: 4-1045, SiLU: 3-387, SiLU: 4-1046, SiLU: 4-1047, SiLU: 4-1048, SiLU: 3-388, SiLU: 4-1049, SiLU: 4-1050, SiLU: 4-1051, SiLU: 4-1052, SiLU: 4-1053, SiLU: 3-389, SiLU: 4-1054, SiLU: 4-1055, SiLU: 4-1056, SiLU: 3-390, SiLU: 4-1057, SiLU: 4-1058, SiLU: 4-1059, SiLU: 3-391, SiLU: 4-1060, SiLU: 4-1061, SiLU: 4-1062, SiLU: 3-392, SiLU: 4-1063, SiLU: 4-1064, SiLU: 4-1065, Upsample: 2-16, Concat: 2-17, C3: 2-18, Conv: 3-393, Conv2d: 4-1066, SiLU: 3-394, SiLU: 3-395, SiLU: 4-1067, SiLU: 4-1068, SiLU: 4-1069, SiLU: 3-396, SiLU: 4-1070, SiLU: 4-1071, SiLU: 4-1072, SiLU: 3-397, SiLU: 4-1073, SiLU: 4-1074, SiLU: 4-1075, SiLU: 3-398, SiLU: 4-1076, SiLU: 4-1077, SiLU: 4-1078, SiLU: 4-1079, SiLU: 4-1080, SiLU: 3-399, SiLU: 4-1081, SiLU: 4-1082, SiLU: 4-1083, SiLU: 3-400, SiLU: 4-1084, SiLU: 4-1085, SiLU: 4-1086, SiLU: 3-401, SiLU: 4-1087, SiLU: 4-1088, SiLU: 4-1089, SiLU: 3-402, SiLU: 4-1090, SiLU: 4-1091, SiLU: 4-1092, Sequential: 3-403, Bottleneck: 4-1093, SiLU: 3-404, SiLU: 3-405, SiLU: 4-1094, SiLU: 4-1095, SiLU: 4-1096, SiLU: 3-406, SiLU: 4-1097, SiLU: 4-1098, SiLU: 4-1099, SiLU: 3-407, SiLU: 4-1100, SiLU: 4-1101, SiLU: 4-1102, SiLU: 3-408, SiLU: 4-1103, SiLU: 4-1104, SiLU: 4-1105, SiLU: 4-1106, SiLU: 4-1107, SiLU: 3-409, SiLU: 4-1108, SiLU: 4-1109, SiLU: 4-1110, SiLU: 3-410, SiLU: 4-1111, SiLU: 4-1112, SiLU: 4-1113, SiLU: 3-411, SiLU: 4-1114, SiLU: 4-1115, SiLU: 4-1116, SiLU: 3-412, SiLU: 4-1117, SiLU: 4-1118, SiLU: 4-1119, SiLU: 3-413, SiLU: 3-414, SiLU: 4-1120, SiLU: 4-1121, SiLU: 4-1122, SiLU: 3-415, SiLU: 4-1123, SiLU: 4-1124, SiLU: 4-1125, SiLU: 3-416, SiLU: 4-1126, SiLU: 4-1127, SiLU: 4-1128, SiLU: 3-417, SiLU: 4-1129, SiLU: 4-1130, SiLU: 4-1131, SiLU: 4-1132, SiLU: 4-1133, SiLU: 3-418, SiLU: 4-1134, SiLU: 4-1135, SiLU: 4-1136, SiLU: 3-419, SiLU: 4-1137, SiLU: 4-1138, SiLU: 4-1139, SiLU: 3-420, SiLU: 4-1140, SiLU: 4-1141, SiLU: 4-1142, SiLU: 3-421, SiLU: 4-1143, SiLU: 4-1144, SiLU: 4-1145, Conv: 3-422, Conv2d: 4-1146, SiLU: 3-423, SiLU: 3-424, SiLU: 4-1147, SiLU: 4-1148, SiLU: 4-1149, SiLU: 3-425, SiLU: 4-1150, SiLU: 4-1151, SiLU: 4-1152, SiLU: 3-426, SiLU: 4-1153, SiLU: 4-1154, SiLU: 4-1155, SiLU: 3-427, SiLU: 4-1156, SiLU: 4-1157, SiLU: 4-1158, SiLU: 4-1159, SiLU: 4-1160, SiLU: 3-428, SiLU: 4-1161, SiLU: 4-1162, SiLU: 4-1163, SiLU: 3-429, SiLU: 4-1164, SiLU: 4-1165, SiLU: 4-1166, SiLU: 3-430, SiLU: 4-1167, SiLU: 4-1168, SiLU: 4-1169, SiLU: 3-431, SiLU: 4-1170, SiLU: 4-1171, SiLU: 4-1172, Conv: 3-432, Conv2d: 4-1173, SiLU: 3-433, SiLU: 3-434, SiLU: 4-1174, SiLU: 4-1175, SiLU: 4-1176, SiLU: 3-435, SiLU: 4-1177, SiLU: 4-1178, SiLU: 4-1179, SiLU: 3-436, SiLU: 4-1180, SiLU: 4-1181, SiLU: 4-1182, SiLU: 3-437, SiLU: 4-1183, SiLU: 4-1184, SiLU: 4-1185, SiLU: 4-1186, SiLU: 4-1187, SiLU: 3-438, SiLU: 4-1188, SiLU: 4-1189, SiLU: 4-1190, SiLU: 3-439, SiLU: 4-1191, SiLU: 4-1192, SiLU: 4-1193, SiLU: 3-440, SiLU: 4-1194, SiLU: 4-1195, SiLU: 4-1196, SiLU: 3-441, SiLU: 4-1197, SiLU: 4-1198, SiLU: 4-1199, Conv: 2-19, Conv2d: 3-442, SiLU: 3-443, SiLU: 3-444, SiLU: 4-1200, SiLU: 4-1201, SiLU: 4-1202, SiLU: 3-445, SiLU: 4-1203, SiLU: 4-1204, SiLU: 4-1205, SiLU: 3-446, SiLU: 4-1206, SiLU: 4-1207, SiLU: 4-1208, SiLU: 3-447, SiLU: 4-1209, SiLU: 4-1210, SiLU: 4-1211, SiLU: 4-1212, SiLU: 4-1213, SiLU: 3-448, SiLU: 4-1214, SiLU: 4-1215, SiLU: 4-1216, SiLU: 3-449, SiLU: 4-1217, SiLU: 4-1218, SiLU: 4-1219, SiLU: 3-450, SiLU: 4-1220, SiLU: 4-1221, SiLU: 4-1222, SiLU: 3-451, SiLU: 4-1223, SiLU: 4-1224, SiLU: 4-1225, Concat: 2-20, C3: 2-21, Conv: 3-452, Conv2d: 4-1226, SiLU: 3-453, SiLU: 3-454, SiLU: 4-1227, SiLU: 4-1228, SiLU: 4-1229, SiLU: 3-455, SiLU: 4-1230, SiLU: 4-1231, SiLU: 4-1232, SiLU: 3-456, SiLU: 4-1233, SiLU: 4-1234, SiLU: 4-1235, SiLU: 3-457, SiLU: 4-1236, SiLU: 4-1237, SiLU: 4-1238, SiLU: 4-1239, SiLU: 4-1240, SiLU: 3-458, SiLU: 4-1241, SiLU: 4-1242, SiLU: 4-1243, SiLU: 3-459, SiLU: 4-1244, SiLU: 4-1245, SiLU: 4-1246, SiLU: 3-460, SiLU: 4-1247, SiLU: 4-1248, SiLU: 4-1249, SiLU: 3-461, SiLU: 4-1250, SiLU: 4-1251, SiLU: 4-1252, Sequential: 3-462, Bottleneck: 4-1253, SiLU: 3-463, SiLU: 3-464, SiLU: 4-1254, SiLU: 4-1255, SiLU: 4-1256, SiLU: 3-465, SiLU: 4-1257, SiLU: 4-1258, SiLU: 4-1259, SiLU: 3-466, SiLU: 4-1260, SiLU: 4-1261, SiLU: 4-1262, SiLU: 3-467, SiLU: 4-1263, SiLU: 4-1264, SiLU: 4-1265, SiLU: 4-1266, SiLU: 4-1267, SiLU: 3-468, SiLU: 4-1268, SiLU: 4-1269, SiLU: 4-1270, SiLU: 3-469, SiLU: 4-1271, SiLU: 4-1272, SiLU: 4-1273, SiLU: 3-470, SiLU: 4-1274, SiLU: 4-1275, SiLU: 4-1276, SiLU: 3-471, SiLU: 4-1277, SiLU: 4-1278, SiLU: 4-1279, SiLU: 3-472, SiLU: 3-473, SiLU: 4-1280, SiLU: 4-1281, SiLU: 4-1282, SiLU: 3-474, SiLU: 4-1283, SiLU: 4-1284, SiLU: 4-1285, SiLU: 3-475, SiLU: 4-1286, SiLU: 4-1287, SiLU: 4-1288, SiLU: 3-476, SiLU: 4-1289, SiLU: 4-1290, SiLU: 4-1291, SiLU: 4-1292, SiLU: 4-1293, SiLU: 3-477, SiLU: 4-1294, SiLU: 4-1295, SiLU: 4-1296, SiLU: 3-478, SiLU: 4-1297, SiLU: 4-1298, SiLU: 4-1299, SiLU: 3-479, SiLU: 4-1300, SiLU: 4-1301, SiLU: 4-1302, SiLU: 3-480, SiLU: 4-1303, SiLU: 4-1304, SiLU: 4-1305, Conv: 3-481, Conv2d: 4-1306, SiLU: 3-482, SiLU: 3-483, SiLU: 4-1307, SiLU: 4-1308, SiLU: 4-1309, SiLU: 3-484, SiLU: 4-1310, SiLU: 4-1311, SiLU: 4-1312, SiLU: 3-485, SiLU: 4-1313, SiLU: 4-1314, SiLU: 4-1315, SiLU: 3-486, SiLU: 4-1316, SiLU: 4-1317, SiLU: 4-1318, SiLU: 4-1319, SiLU: 4-1320, SiLU: 3-487, SiLU: 4-1321, SiLU: 4-1322, SiLU: 4-1323, SiLU: 3-488, SiLU: 4-1324, SiLU: 4-1325, SiLU: 4-1326, SiLU: 3-489, SiLU: 4-1327, SiLU: 4-1328, SiLU: 4-1329, SiLU: 3-490, SiLU: 4-1330, SiLU: 4-1331, SiLU: 4-1332, Conv: 3-491, Conv2d: 4-1333, SiLU: 3-492, SiLU: 3-493, SiLU: 4-1334, SiLU: 4-1335, SiLU: 4-1336, SiLU: 3-494, SiLU: 4-1337, SiLU: 4-1338, SiLU: 4-1339, SiLU: 3-495, SiLU: 4-1340, SiLU: 4-1341, SiLU: 4-1342, SiLU: 3-496, SiLU: 4-1343, SiLU: 4-1344, SiLU: 4-1345, SiLU: 4-1346, SiLU: 4-1347, SiLU: 3-497, SiLU: 4-1348, SiLU: 4-1349, SiLU: 4-1350, SiLU: 3-498, SiLU: 4-1351, SiLU: 4-1352, SiLU: 4-1353, SiLU: 3-499, SiLU: 4-1354, SiLU: 4-1355, SiLU: 4-1356, SiLU: 3-500, SiLU: 4-1357, SiLU: 4-1358, SiLU: 4-1359, Conv: 2-22, Conv2d: 3-501, SiLU: 3-502, SiLU: 3-503, SiLU: 4-1360, SiLU: 4-1361, SiLU: 4-1362, SiLU: 3-504, SiLU: 4-1363, SiLU: 4-1364, SiLU: 4-1365, SiLU: 3-505, SiLU: 4-1366, SiLU: 4-1367, SiLU: 4-1368, SiLU: 3-506, SiLU: 4-1369, SiLU: 4-1370, SiLU: 4-1371, SiLU: 4-1372, SiLU: 4-1373, SiLU: 3-507, SiLU: 4-1374, SiLU: 4-1375, SiLU: 4-1376, SiLU: 3-508, SiLU: 4-1377, SiLU: 4-1378, SiLU: 4-1379, SiLU: 3-509, SiLU: 4-1380, SiLU: 4-1381, SiLU: 4-1382, SiLU: 3-510, SiLU: 4-1383, SiLU: 4-1384, SiLU: 4-1385, Concat: 2-23, C3: 2-24, Conv: 3-511, Conv2d: 4-1386, SiLU: 3-512, SiLU: 3-513, SiLU: 4-1387, SiLU: 4-1388, SiLU: 4-1389, SiLU: 3-514, SiLU: 4-1390, SiLU: 4-1391, SiLU: 4-1392, SiLU: 3-515, SiLU: 4-1393, SiLU: 4-1394, SiLU: 4-1395, SiLU: 3-516, SiLU: 4-1396, SiLU: 4-1397, SiLU: 4-1398, SiLU: 4-1399, SiLU: 4-1400, SiLU: 3-517, SiLU: 4-1401, SiLU: 4-1402, SiLU: 4-1403, SiLU: 3-518, SiLU: 4-1404, SiLU: 4-1405, SiLU: 4-1406, SiLU: 3-519, SiLU: 4-1407, SiLU: 4-1408, SiLU: 4-1409, SiLU: 3-520, SiLU: 4-1410, SiLU: 4-1411, SiLU: 4-1412, Sequential: 3-521, Bottleneck: 4-1413, SiLU: 3-522, SiLU: 3-523, SiLU: 4-1414, SiLU: 4-1415, SiLU: 4-1416, SiLU: 3-524, SiLU: 4-1417, SiLU: 4-1418, SiLU: 4-1419, SiLU: 3-525, SiLU: 4-1420, SiLU: 4-1421, SiLU: 4-1422, SiLU: 3-526, SiLU: 4-1423, SiLU: 4-1424, SiLU: 4-1425, SiLU: 4-1426, SiLU: 4-1427, SiLU: 3-527, SiLU: 4-1428, SiLU: 4-1429, SiLU: 4-1430, SiLU: 3-528, SiLU: 4-1431, SiLU: 4-1432, SiLU: 4-1433, SiLU: 3-529, SiLU: 4-1434, SiLU: 4-1435, SiLU: 4-1436, SiLU: 3-530, SiLU: 4-1437, SiLU: 4-1438, SiLU: 4-1439, SiLU: 3-531, SiLU: 3-532, SiLU: 4-1440, SiLU: 4-1441, SiLU: 4-1442, SiLU: 3-533, SiLU: 4-1443, SiLU: 4-1444, SiLU: 4-1445, SiLU: 3-534, SiLU: 4-1446, SiLU: 4-1447, SiLU: 4-1448, SiLU: 3-535, SiLU: 4-1449, SiLU: 4-1450, SiLU: 4-1451, SiLU: 4-1452, SiLU: 4-1453, SiLU: 3-536, SiLU: 4-1454, SiLU: 4-1455, SiLU: 4-1456, SiLU: 3-537, SiLU: 4-1457, SiLU: 4-1458, SiLU: 4-1459, SiLU: 3-538, SiLU: 4-1460, SiLU: 4-1461, SiLU: 4-1462, SiLU: 3-539, SiLU: 4-1463, SiLU: 4-1464, SiLU: 4-1465, Conv: 3-540, Conv2d: 4-1466, SiLU: 3-541, SiLU: 3-542, SiLU: 4-1467, SiLU: 4-1468, SiLU: 4-1469, SiLU: 3-543, SiLU: 4-1470, SiLU: 4-1471, SiLU: 4-1472, SiLU: 3-544, SiLU: 4-1473, SiLU: 4-1474, SiLU: 4-1475, SiLU: 3-545, SiLU: 4-1476, SiLU: 4-1477, SiLU: 4-1478, SiLU: 4-1479, SiLU: 4-1480, SiLU: 3-546, SiLU: 4-1481, SiLU: 4-1482, SiLU: 4-1483, SiLU: 3-547, SiLU: 4-1484, SiLU: 4-1485, SiLU: 4-1486, SiLU: 3-548, SiLU: 4-1487, SiLU: 4-1488, SiLU: 4-1489, SiLU: 3-549, SiLU: 4-1490, SiLU: 4-1491, SiLU: 4-1492, Conv: 3-550, Conv2d: 4-1493, SiLU: 3-551, SiLU: 3-552, SiLU: 4-1494, SiLU: 4-1495, SiLU: 4-1496, SiLU: 3-553, SiLU: 4-1497, SiLU: 4-1498, SiLU: 4-1499, SiLU: 3-554, SiLU: 4-1500, SiLU: 4-1501, SiLU: 4-1502, SiLU: 3-555, SiLU: 4-1503, SiLU: 4-1504, SiLU: 4-1505, SiLU: 4-1506, SiLU: 4-1507, SiLU: 3-556, SiLU: 4-1508, SiLU: 4-1509, SiLU: 4-1510, SiLU: 3-557, SiLU: 4-1511, SiLU: 4-1512, SiLU: 4-1513, SiLU: 3-558, SiLU: 4-1514, SiLU: 4-1515, SiLU: 4-1516, SiLU: 3-559, SiLU: 4-1517, SiLU: 4-1518, SiLU: 4-1519, Conv2d: 4-1520]
my yolov5s.yaml head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13

[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [256, False]], # 17 (P3/8-small)

[-1, 1, Conv, [256, 3, 2]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)

[-1, 1, Conv, [512, 3, 2]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)

[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
[-1,1,ReshapeOutput,[1]]# reshape output
]

@glenn-jocher
Copy link
Member

Hello @yuqilol, it looks like you're on the right track with adding the reshape layer to your .yaml file. However, the error message seems to be cut off, so I can't see the exact issue. Nonetheless, I can provide some general advice.

First, ensure that the ReshapeOutput class is properly defined in your model's codebase and that it's imported correctly in the script where you're defining your model architecture.

Secondly, the way you've added the ReshapeOutput layer to your .yaml file seems correct, but make sure that the indentation is consistent with the rest of the file. YAML files are sensitive to indentation, and incorrect indentation can lead to errors.

Lastly, the ReshapeOutput layer should be defined to match the expected output dimensions for TFLite. If you're getting an error related to the shape, double-check that the dimensions you're reshaping to are compatible with the preceding layer's output.

If you continue to experience issues, please provide the full error message, and I'll be happy to help you troubleshoot further. Remember, the error message is key to understanding what might be going wrong. Keep up the good work! 🛠️

@yuqilol
Copy link
Author

yuqilol commented Jan 17, 2024

1705484883190(1)
It seems that there is no problem with indentation of my yaml file, but the following error problem occurs when I train, I don't know why.
train: weights=yolov5s.pt, cfg=models\yolov5s.yaml, data=data\coco128.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=1, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data\hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs\train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, ndjson_console=False, ndjson_file=False
github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5
YOLOv5 2024-1-9 Python-3.8.18 torch-2.1.2+cpu CPU

hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0
Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 runs in Comet
TensorBoard: Start with 'tensorboard --logdir runs\train', view at http://localhost:6006/

             from  n    params  module                                  arguments                     

0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 18816 models.common.C3 [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 2 115712 models.common.C3 [128, 128, 2]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 3 625152 models.common.C3 [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 1182720 models.common.C3 [512, 512, 1]
9 -1 1 656896 models.common.SPPF [512, 512, 5]
10 -1 1 131584 models.common.Conv [512, 256, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 361984 models.common.C3 [512, 256, 1, False]
14 -1 1 33024 models.common.Conv [256, 128, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 90880 models.common.C3 [256, 128, 1, False]
18 -1 1 147712 models.common.Conv [128, 128, 3, 2]
19 [-1, 14] 1 0 models.common.Concat [1]
20 -1 1 296448 models.common.C3 [256, 256, 1, False]
21 -1 1 590336 models.common.Conv [256, 256, 3, 2]
22 [-1, 10] 1 0 models.common.Concat [1]
23 -1 1 1182720 models.common.C3 [512, 512, 1, False]
24 [17, 20, 23] 1 229245 models.yolo.Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
25 -1 1 0 models.common.ReshapeOutput [512, 8]
YOLOv5s summary: 215 layers, 7235389 parameters, 7235389 gradients

Transferred 348/349 items from yolov5s.pt
Traceback (most recent call last):
File "F:\down_project\yolov5-master\yolov5-master\train.py", line 846, in
main(opt)
File "F:\down_project\yolov5-master\yolov5-master\train.py", line 616, in main
train(opt.hyp, opt, device, callbacks)
File "F:\down_project\yolov5-master\yolov5-master\train.py", line 203, in train
gs = max(int(model.stride.max()), 32) # grid size (max stride)
File "F:\ANACONDA\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1695, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'DetectionModel' object has no attribute 'stride'

@yuqilol
Copy link
Author

yuqilol commented Jan 17, 2024

I printed the structure of the model and found nothing in reshape, is that normal?
Uploading 1705485197167(1).jpg…

@yuqilol
Copy link
Author

yuqilol commented Jan 17, 2024

DetectionModel(
(model): Sequential(
(0): Conv(
(conv): Conv2d(3, 32, kernel_size=(6, 6), stride=(2, 2), padding=(2, 2))
(act): SiLU(inplace=True)
)
(1): Conv(
(conv): Conv2d(32, 64, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(2): C3(
(cv1): Conv(
(conv): Conv2d(64, 32, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(64, 32, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(32, 32, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(3): Conv(
(conv): Conv2d(64, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(4): C3(
(cv1): Conv(
(conv): Conv2d(128, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
(1): Bottleneck(
(cv1): Conv(
(conv): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(5): Conv(
(conv): Conv2d(128, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(6): C3(
(cv1): Conv(
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
(1): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
(2): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(7): Conv(
(conv): Conv2d(256, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(8): C3(
(cv1): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(512, 512, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(9): SPPF(
(cv1): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(1024, 512, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): MaxPool2d(kernel_size=5, stride=1, padding=2, dilation=1, ceil_mode=False)
)
(10): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(11): Upsample(scale_factor=2.0, mode='nearest')
(12): Concat()
(13): C3(
(cv1): Conv(
(conv): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(14): Conv(
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(15): Upsample(scale_factor=2.0, mode='nearest')
(16): Concat()
(17): C3(
(cv1): Conv(
(conv): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(18): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(19): Concat()
(20): C3(
(cv1): Conv(
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(21): Conv(
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(act): SiLU(inplace=True)
)
(22): Concat()
(23): C3(
(cv1): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv3): Conv(
(conv): Conv2d(512, 512, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): Sequential(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)
(24): Detect(
(m): ModuleList(
(0): Conv2d(128, 255, kernel_size=(1, 1), stride=(1, 1))
(1): Conv2d(256, 255, kernel_size=(1, 1), stride=(1, 1))
(2): Conv2d(512, 255, kernel_size=(1, 1), stride=(1, 1))
)
)
(25): ReshapeOutput()
)
)

@glenn-jocher
Copy link
Member

Hello @yuqilol,

From the error message and the model structure you've provided, it seems that the ReshapeOutput layer is indeed present in your model, but there might be an issue with how it's being integrated or with the model's attribute access.

The error AttributeError: 'DetectionModel' object has no attribute 'stride' suggests that somewhere in your code, there's an attempt to access a stride attribute on the DetectionModel object, which doesn't exist. This could be a result of the changes made to the model architecture, such as adding the ReshapeOutput layer.

Here are a few steps to troubleshoot the issue:

  1. Ensure that the ReshapeOutput layer is correctly defined and that it doesn't interfere with any expected attributes of the model, such as stride.
  2. Check the code where the stride attribute is being accessed. This might be part of the forward pass or some other function that expects the model to have a stride attribute.
  3. Verify that the Detect layer and the ReshapeOutput layer are correctly configured in the .yaml file. The Detect layer should output the predictions, and the ReshapeOutput layer should reshape these predictions as needed.

Since the error message indicates an issue with the stride attribute, you might need to review the modifications made to the model and ensure that all necessary attributes are properly maintained or adapted.

If you continue to face issues, consider providing more context or the specific part of the code where the error occurs, so we can help you more effectively.

@yuqilol
Copy link
Author

yuqilol commented Jan 24, 2024

Thanks for your reply, I found that there was no tpu on our device, so the task of changing the structure was cancelled, but there was npu on the device, we could not use the converted model to call npu. In addition, the value of exported tflite output data given by the official is different from that of coreml output. The details are as follows: Figure 1 shows the output of tflite, which makes it seem that tflite is not mapped to any place. Figure 2 shows the output of coreml, which we can accept. What code should I change to get rid of the tflite mapping?
2
1

@glenn-jocher
Copy link
Member

Hello again @yuqilol,

It seems you've decided not to modify the model structure due to the absence of a TPU on your device and are now looking into NPU support and output discrepancies between TFLite and CoreML models.

Regarding NPU support, this is highly dependent on the specific hardware and software stack you are using. If the NPU has specific requirements or a dedicated SDK/API for model deployment, you would need to follow the manufacturer's guidelines for optimizing and deploying your model to leverage the NPU.

As for the differences in output between TFLite and CoreML, this could be due to a variety of factors, including differences in how the models are quantized, optimized, or even how the post-processing is handled in each framework. To address this, you would typically:

  1. Ensure that both models are using the same pre-processing and post-processing steps.
  2. Check if there are any quantization steps that might be affecting the TFLite model's output.
  3. Compare the inference code for both TFLite and CoreML to ensure they are consistent.

Unfortunately, without specific details on the output differences and the exact code used for inference, it's challenging to provide a precise solution. If you believe there's an issue with the TFLite conversion process within the YOLOv5 repository, please provide detailed information on the steps you've taken, the expected output, and the actual output you're observing.

For now, I would recommend reviewing the export and inference scripts for TFLite to ensure they align with your requirements and the expected output format. If there's a post-processing step that's not being applied correctly in the TFLite model, you might need to adjust the export script or the inference code to match the CoreML model's behavior.

If you continue to encounter issues, please provide more detailed information or consider opening an issue in the YOLOv5 repository with all the necessary details for further assistance.

@yuqilol
Copy link
Author

yuqilol commented Jan 25, 2024

Thank you for your answer, I have solved the problem. The first solution is to convert yolo's export.py into onnx, and then convert onnx into tflite. During this process, I made three mistakes. Second, I did not choose an environment with gpu when exporting, resulting in the weight could not be loaded on the graphics card. Third, our Android engineer enabled the npu interface and squeezed out the gpu interface, but npu was not called. The second solution is to export tflite using yolo's export.py. After my test, I found that tflite maps data from 0-640 to 0-1, which is not explained in the documents of yolo and tflite.

@yuqilol
Copy link
Author

yuqilol commented Jan 25, 2024

Requirements:
$ pip install -r requirements.txt coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu # CPU
$ pip install -r requirements.txt coremltools onnx onnx-simplifier onnxruntime-gpu openvino-dev tensorflow # GPU

@glenn-jocher
Copy link
Member

I'm glad to hear that you've resolved the problem, @yuqilol! It sounds like you encountered a few challenges along the way, but it's great that you were able to navigate through them.

For future reference and for others who might encounter similar issues:

  1. When converting models, it's important to ensure that the conversion environment matches the target deployment environment, especially regarding GPU support.
  2. Documentation may not always cover every detail of the data mapping or conversion process, so experimentation and careful testing are often necessary to understand the behavior of the converted models fully.
  3. When working with different hardware accelerators like GPUs or NPUs, it's crucial to ensure that the correct interfaces and drivers are enabled and that the model is compatible with the specific hardware.

Your experience highlights the importance of a thorough understanding of the entire model conversion and deployment pipeline. Thank you for sharing your solutions, and best of luck with your project on Android! If you have any more questions or run into further issues, feel free to reach out. Happy coding! 🚀

Copy link
Contributor

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

@github-actions github-actions bot added the Stale label Feb 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants