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

[Layer] Introduce upsample2d layer #2639

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Conversation

heka1024
Copy link
Contributor

Add upsample2d layer in nntrainer. This could be used in YOLO or other layers.

Self evaluation:

  1. Build test: [X]Passed [ ]Failed [ ]Skipped
  2. Run test: [X]Passed [ ]Failed [ ]Skipped

@taos-ci
Copy link

taos-ci commented Jun 17, 2024

📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #2639. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/.

@heka1024
Copy link
Contributor Author

cc. @kimhan0515, @Boseong-Seo

@heka1024 heka1024 force-pushed the upsampling branch 3 times, most recently from b7090be to d1500f2 Compare June 17, 2024 18:50
@taos-ci
Copy link

taos-ci commented Jun 17, 2024

:octocat: cibot: @heka1024, A builder checker could not be completed because one of the checkers is not completed. In order to find out a reason, please go to http://ci.nnstreamer.ai/nntrainer/ci/repo-workers/pr-checker/2639-202406180350590.31319904327393-d1500f25c6072ffdcba28bb6b7ebd7b501da1501/.

@heka1024
Copy link
Contributor Author

C++ exception with description "[parseutil] requested file not opened, file path: ./res/test/unittest_layers/upsample2d_2x2_nearest.nnlayergolden reason: No such file or directory" thrown in the test body.
[ FAILED ] Upsample2D/LayerGoldenTest.run/0, where GetParam() = (32-byte object <40-EB D5-B3 86-55 00-00 00-00 00-00 00-00 00-00 C0-BB D2-B3 86-55 00-00 E0-B8 D2-B3 86-55 00-00>, { "upsample=nearest", "kernel_size=2,2" }, 0x5586b3db2b8d pointing to "1:1:2:2", 0x5586b3db2aa0 pointing to "upsample2d_2x2_nearest.nnlayergolden", 0, "nchw", "fp32", "fp32") (0 ms)
[ RUN ] Upsample2D/LayerGoldenTest.run/1
unknown file: Failure
C++ exception with description "[parseutil] requested file not opened, file path: ./res/test/unittest_layers/upsample2d_3x3_nearest.nnlayergolden reason: No such file or directory" thrown in the test body.
[ FAILED ] Upsample2D/LayerGoldenTest.run/1, where GetParam() = (32-byte object <40-EB D5-B3 86-55 00-00 00-00 00-00 00-00 00-00 C0-BB D2-B3 86-55 00-00 E0-B8 D2-B3 86-55 00-00>, { "upsample=nearest", "kernel_size=3,3" }, 0x5586b3db2b95 pointing to "1:1:3:3", 0x5586b3db2ac8 pointing to "upsample2d_3x3_nearest.nnlayergolden", 0, "nchw", "fp32", "fp32") (0 ms)

There are some CI issues related about generating test data. But I already added testcase in gen_layer_tests.py so I'm bit confused. What should I do to fix the issue? Could you help me @jijoongmoon @baek2sm ?

Copy link
Member

@myungjoo myungjoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file, upsample2d_2x2_nearest.nnlayergolden doesn't exist.

Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heka1024, 💯 All CI checkers are successfully verified. Thanks.

@heka1024
Copy link
Contributor Author

@myungjoo I added golden layer files. Thank you.

Copy link
Contributor

@baek2sm baek2sm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. You did a great job.

test/input_gen/gen_layer_tests.py Show resolved Hide resolved
/**
* @brief Upsampling operation type class
*/
enum class Enum { nearest, bilinear };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Interpolation instead of Enum for clarity?

Suggested change
enum class Enum { nearest, bilinear };
enum class Interpolation { nearest, bilinear };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djeong20 To use EnumProperty<UpsampleModeInfo> in class UpsampleMode, we have to declare it as name Enum in code as far as I knew.

image

If there is an alternative way, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about utilizing using Enum?

struct ActivationTypeInfo {
using Enum = nntrainer::ActivationType;
static constexpr std::initializer_list<Enum> EnumList = {
Enum::ACT_TANH, Enum::ACT_SIGMOID, Enum::ACT_RELU,
Enum::ACT_SOFTMAX, Enum::ACT_LEAKY_RELU, Enum::ACT_SWISH,
Enum::ACT_GELU, Enum::ACT_QUICK_GELU, Enum::ACT_NONE,
Enum::ACT_UNKNOWN};
static constexpr const char *EnumStr[] = {"tanh", "sigmoid", "relu",
"softmax", "leaky_relu", "swish",
"gelu", "quick_gelu", "none",
"unknown"};
};

Copy link
Contributor Author

@heka1024 heka1024 Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djeong20 Thank you for comment. I made a change.

Add `upsample2d` layer in nntrainer. This could be used in YOLO or other layers.

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Co-authored-by: Boseong Seo <[email protected]>
Co-authored-by: kimhan0515 <[email protected]>
Signed-off-by: heka1024 <[email protected]>
Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heka1024, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Collaborator

@jijoongmoon jijoongmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jijoongmoon jijoongmoon merged commit 0688e0d into nnstreamer:main Jul 2, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants