In Keras’s supervised consistency-training example, a teacher first learns from clean, labeled images. A student then learns from augmented versions of those same images using both the ground-truth labels and the teacher’s predictions on the clean inputs. The goal is to make predictions less sensitive to plausible image changes—not to guarantee better accuracy on every dataset or shift.
How the Keras workflow works
The official Keras consistency-training example is a two-stage, supervised teacher–student process. It uses labeled examples throughout: labels train the teacher and remain part of the student’s objective.
- Set up the classifier. Build an image classifier and save its initial weights so teacher and student initialization can be controlled.
- Train the teacher on clean images. Fit the teacher with the ordinary labeled classification objective. The example’s teacher workflow includes callbacks such as learning-rate reduction and early stopping; these are implementation choices, not universal requirements.
- Get teacher targets for clean inputs. Run clean training images through the trained teacher and retain its logits as targets, keeping each target paired with its source image.
- Make student inputs. Create augmented versions of those same images. The Keras example uses RandAugment to generate noisy student inputs.
- Train the student with both objectives. The student sees augmented inputs and is optimized against their ground-truth labels as well as the teacher’s predictions for the corresponding clean images.
- Evaluate both ordinary accuracy and robustness. Use the usual held-out test set for standard accuracy, and a corruption or distribution-shift benchmark representative of the intended deployment conditions for robustness.
What loss does the student use?
The example combines sparse categorical cross-entropy against the true class labels with a consistency or distillation term. For that second term, teacher and student logits are softened using a temperature, then compared with Kullback–Leibler (KL) divergence. The example averages the two loss components.
Temperature affects how much information is retained in the softened class distributions, while augmentation strength affects the inputs the student must handle. Neither should be treated as a one-size-fits-all setting: validate the temperature, loss balance, augmentation policy, and model scale on your own data. The Keras walkthrough is a custom teacher–student loss implementation, rather than simply a parameter penalty added through Keras’s Regularizer API.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Why use augmented student inputs?
Consistency training encourages the student’s output on an augmented image to agree with the teacher’s output on its clean counterpart. This can help when the augmentations represent realistic variations expected at deployment, such as common image corruptions. It can fail to help—or teach the wrong target—if an augmentation changes the image’s class or creates an implausible example. A teacher’s prediction can also be wrong, so matching it is not a guarantee of improved accuracy or robustness.
How this differs from FixMatch and AdaMatch
The methods are related, but the Keras example’s supervised setup should not be confused with semi-supervised learning on unlabeled images.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
| Method | Are unlabeled images required? | How targets are formed | What to know |
|---|---|---|---|
| Supervised consistency training in Keras | No; the example uses labeled images. | A trained teacher predicts clean images; the student matches those predictions on augmented versions while also learning from labels. | Teacher–student training with a supervised label loss and a consistency/distillation loss. The example uses RandAugment. |
| FixMatch | Yes; unlabeled images are central to the method. | Generate a pseudo-label from a weakly augmented unlabeled image, then train on a strongly augmented version when the prediction passes a confidence threshold. | Combines consistency regularization with confidence-based pseudo-labeling. See the FixMatch paper and Google Research summary. The reference Google Research repository states, “This is not an officially supported Google product.” |
| AdaMatch | It is a related semi-supervised and domain-adaptation direction, not the algorithm in the Keras consistency-training example. | See the method’s own description for its target construction. | Consider it when the problem involves labeled and unlabeled data or shifted domains; the Keras example does not implement AdaMatch. See Keras’s AdaMatch example. |
The additional teacher predictions and student training make this workflow more involved than fitting a single classifier. Actual runtime and accuracy depend on the model, dataset, hardware, and training configuration; the cited method descriptions do not establish universal speed or accuracy comparisons.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What the Keras example does—and does not—demonstrate
The Keras page describes CIFAR-10-C as covering 19 corruption types at five severity levels. It names the benchmark but explicitly says the short demonstration does not run a full corruption-benchmark assessment. Its brief training run is illustrative, not evidence of a quantified robustness gain. Do not treat a displayed demonstration result as a full benchmark conclusion.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
To make a robustness claim for your own model, report the dataset and splits, architecture, augmentation, training budget, baseline, and evaluation protocol. Report ordinary test performance separately from corruption performance: a change in one does not by itself establish a change in the other.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Adapting the example to your dataset
- Check label preservation. Use transformations that retain the correct class and resemble plausible deployment variations.
- Keep target pairing intact. A teacher target must correspond to the clean source image for the augmented student input.
- Validate the design choices. Tune model size, augmentation strength, temperature, and the relative loss contributions using an appropriate validation setup.
- Choose evaluations that match the goal. Keep a conventional held-out test set and add a relevant corruption or shifted-domain evaluation if robustness is the objective.
- Check software compatibility. The Keras page’s historical installation note says TensorFlow 2.4 or higher, but its source has since been modified for newer Keras. Check the current example and your installed Keras, TensorFlow, and backend versions before adapting code; do not assume the historical note is a current compatibility guarantee.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

