จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: ถอดรหัสJpeg
#include <image_ops.h>
ถอดรหัสภาพที่เข้ารหัส JPEG เป็นเทนเซอร์ uint8
สรุป
channels
attr ระบุจำนวนช่องสีที่ต้องการสำหรับภาพที่ถอดรหัส
ค่าที่ยอมรับคือ:
- 0: ใช้จำนวนช่องสัญญาณในภาพที่เข้ารหัส JPEG
- 1: ส่งออกภาพระดับสีเทา
- 3: ส่งออกภาพ RGB
หากจำเป็น รูปภาพที่เข้ารหัส JPEG จะถูกแปลงให้ตรงกับจำนวนช่องสีที่ต้องการ
ratio
Attr ช่วยให้สามารถลดขนาดรูปภาพตามตัวประกอบจำนวนเต็มในระหว่างการถอดรหัส ค่าที่อนุญาตคือ 1, 2, 4 และ 8 ซึ่งเร็วกว่าการลดขนาดรูปภาพในภายหลังมาก
op นี้ยังรองรับการถอดรหัส PNG และ GIF ที่ไม่ใช่ภาพเคลื่อนไหวเนื่องจากอินเทอร์เฟซเหมือนกัน แม้ว่าการใช้ tf.image.decode_image
จะสะอาดกว่าก็ตาม
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- เนื้อหา: 0-D รูปภาพที่เข้ารหัส JPEG
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- ช่อง: จำนวนช่องสีสำหรับภาพที่ถอดรหัส
- อัตราส่วน: อัตราส่วนการลดขนาด
- fancy_upscaling: หากเป็นจริง ให้ใช้การอัปสเกลของโครมาที่ช้ากว่าแต่ดีกว่า (เฉพาะ yuv420/422 เท่านั้น)
- try_recover_truncated: หากเป็นจริงให้ลองกู้คืนรูปภาพจากอินพุตที่ถูกตัดทอน
- Accepted_fraction: เศษส่วนขั้นต่ำที่ต้องการของบรรทัดก่อนที่จะยอมรับอินพุตที่ถูกตัดทอน
- dct_method: สตริงที่ระบุคำใบ้เกี่ยวกับอัลกอริทึมที่ใช้สำหรับการขยายการบีบอัด ค่าเริ่มต้นเป็น "" ซึ่งแมปกับค่าเริ่มต้นเฉพาะระบบ ค่าที่ถูกต้องในปัจจุบันคือ ["INTEGER_FAST", "INTEGER_ACCURATE"] คำใบ้อาจถูกละเว้น (เช่น ไลบรารี jpeg ภายในเปลี่ยนเป็นเวอร์ชันที่ไม่มีตัวเลือกเฉพาะนั้น)
ผลตอบแทน:
-
Output
: 3-D พร้อมรูปทรง [height, width, channels]
..
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
เศษส่วนที่ยอมรับได้
Attrs AcceptableFraction(
float x
)
ช่อง
Attrs Channels(
int64 x
)
วิธีดีท็อกซ์
Attrs DctMethod(
StringPiece x
)
การเพิ่มขนาดแฟนซี
Attrs FancyUpscaling(
bool x
)
อัตราส่วน
Attrs Ratio(
int64 x
)
ลองกู้คืนที่ถูกตัดทอน
Attrs TryRecoverTruncated(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::DecodeJpeg Class Reference\n\ntensorflow::ops::DecodeJpeg\n===========================\n\n`#include \u003cimage_ops.h\u003e`\n\nDecode a JPEG-encoded image to a uint8 tensor.\n\nSummary\n-------\n\nThe attr `channels` indicates the desired number of color channels for the decoded image.\n\nAccepted values are:\n\n\n- 0: Use the number of channels in the JPEG-encoded image.\n- 1: output a grayscale image.\n- 3: output an RGB image.\n\n\u003cbr /\u003e\n\nIf needed, the JPEG-encoded image is transformed to match the requested number of color channels.\n\nThe attr `ratio` allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.\n\nThis op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to use `tf.image.decode_image`.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- contents: 0-D. The JPEG-encoded image.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs)):\n\n- channels: Number of color channels for the decoded image.\n- ratio: Downscaling ratio.\n- fancy_upscaling: If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only).\n- try_recover_truncated: If true try to recover an image from truncated input.\n- acceptable_fraction: The minimum required fraction of lines before a truncated input is accepted.\n- dct_method: string specifying a hint about the algorithm used for decompression. Defaults to \"\" which maps to a system-specific default. Currently valid values are \\[\"INTEGER_FAST\", \"INTEGER_ACCURATE\"\\]. The hint may be ignored (e.g., the internal jpeg library changes to a version that does not have that specific option.)\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 3-D with shape `[height, width, channels]`..\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DecodeJpeg](#classtensorflow_1_1ops_1_1_decode_jpeg_1ac4de6e02218f7ad73fca207fdedcbcad)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents)` ||\n| [DecodeJpeg](#classtensorflow_1_1ops_1_1_decode_jpeg_1a3d8ca9fbb0c56f07d1dfc15707345456)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, const `[DecodeJpeg::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [image](#classtensorflow_1_1ops_1_1_decode_jpeg_1ae6c2f8ba16e122ec6fffd95b36d65ead) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_decode_jpeg_1ac493d7d06da539cac7983b2046f8e9d1) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_decode_jpeg_1a62de1d307840ceb881b006cd346264f1)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_decode_jpeg_1a87002e2b5765be434ab912f4ae691605)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_decode_jpeg_1af3a81e6979e68a832cbbc27890b24704)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| [AcceptableFraction](#classtensorflow_1_1ops_1_1_decode_jpeg_1a3e5bf8acaa171c786f414da0c3717e15)`(float x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n| [Channels](#classtensorflow_1_1ops_1_1_decode_jpeg_1a4ced6488b8eb52569e4c64cb514ae5af)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n| [DctMethod](#classtensorflow_1_1ops_1_1_decode_jpeg_1a11a129bf8cb32c9b4b80b8f379be1356)`(StringPiece x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n| [FancyUpscaling](#classtensorflow_1_1ops_1_1_decode_jpeg_1a32505c9ff48d85625d2d574385e580d7)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n| [Ratio](#classtensorflow_1_1ops_1_1_decode_jpeg_1a55a5fb907878bbe1ed6fc08e696f55ce)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n| [TryRecoverTruncated](#classtensorflow_1_1ops_1_1_decode_jpeg_1a0d8254ea2a648d8ad63b90b2e39d9cf5)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs) |\n\n| ### Structs ||\n|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DecodeJpeg::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs) | Optional attribute setters for [DecodeJpeg](/versions/r1.15/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg). |\n\nPublic attributes\n-----------------\n\n### image\n\n```text\n::tensorflow::Output image\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### DecodeJpeg\n\n```gdscript\n DecodeJpeg(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents\n)\n``` \n\n### DecodeJpeg\n\n```gdscript\n DecodeJpeg(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n const DecodeJpeg::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### AcceptableFraction\n\n```text\nAttrs AcceptableFraction(\n float x\n)\n``` \n\n### Channels\n\n```text\nAttrs Channels(\n int64 x\n)\n``` \n\n### DctMethod\n\n```text\nAttrs DctMethod(\n StringPiece x\n)\n``` \n\n### FancyUpscaling\n\n```text\nAttrs FancyUpscaling(\n bool x\n)\n``` \n\n### Ratio\n\n```text\nAttrs Ratio(\n int64 x\n)\n``` \n\n### TryRecoverTruncated\n\n```text\nAttrs TryRecoverTruncated(\n bool x\n)\n```"]]