Home Blog Page 3866

Evaluating ANN and CNN on CIFAR-10: A Complete Evaluation | by Ravjot Singh | Jul, 2024


Are you interested in how completely different neural networks stack up in opposition to one another? On this weblog, we dive into an thrilling comparability between Synthetic Neural Networks (ANN) and Convolutional Neural Networks (CNN) utilizing the favored CIFAR-10 dataset. We’ll break down the important thing ideas, architectural variations, and real-world functions of ANNs and CNNs. Be part of us as we uncover which mannequin reigns supreme for picture classification duties and why. Let’s get began!

Dataset Overview

The CIFAR-10 dataset is a widely-used dataset for machine studying and laptop imaginative and prescient duties. It consists of 60,000 32×32 colour pictures in 10 completely different courses, with 50,000 coaching pictures and 10,000 take a look at pictures. The courses are airplanes, vehicles, birds, cats, deer, canine, frogs, horses, ships, and vehicles. This weblog explores the efficiency of Synthetic Neural Networks (ANN) and Convolutional Neural Networks (CNN) on the CIFAR-10 dataset.

Pattern dataset

What’s ANN?

Synthetic Neural Networks (ANN) are computational fashions impressed by the human mind. They include interconnected teams of synthetic neurons (nodes) that course of info utilizing a connectionist strategy. ANNs are used for quite a lot of duties, together with classification, regression, and sample recognition.

Ideas of ANN

  • Layers: ANNs include enter, hidden, and output layers.
  • Neurons: Every layer has a number of neurons that course of inputs and produce outputs.
  • Activation Features: Features like ReLU or Sigmoid introduce non-linearity, enabling the community to be taught advanced patterns.
  • Backpropagation: The educational course of includes adjusting weights based mostly on the error gradient.

ANN Structure

ANN = fashions.Sequential([
layers.Flatten(input_shape=(32, 32, 3)),
layers.Dense(3000, activation='relu'),
layers.Dense(1000, activation='relu'),
layers.Dense(10, activation='sigmoid')
])
ANN.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'

What is CNN?

Convolutional Neural Networks (CNN) are specialized ANNs designed for processing structured grid data, like images. They are particularly effective for tasks involving spatial hierarchies, such as image classification and object detection.

Principles of CNN

  • Convolutional Layers: These layers apply convolutional filters to the input to extract features.
  • Pooling Layers: Pooling layers reduce the spatial dimensions, retaining important information while reducing computational load.
  • Fully Connected Layers: After convolutional and pooling layers, fully connected layers are used to make final predictions.

CNN Architecture

CNN = models.Sequential([
layers.Conv2D(input_shape=(32, 32, 3), filters=32, kernel_size=(3, 3), activation='relu'),
layers.MaxPooling2D((2, 2)),
layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu'),
layers.MaxPooling2D((2, 2)),
layers.Flatten(),
layers.Dense(2000, activation='relu'),
layers.Dense(1000, activation='relu'),
layers.Dense(10, activation='softmax')
])
CNN.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])

Coaching and Analysis

Each fashions had been skilled for 10 epochs on the CIFAR-10 dataset. The ANN mannequin makes use of dense layers and is less complicated, whereas the CNN mannequin makes use of convolutional and pooling layers, making it extra advanced and appropriate for picture knowledge.

ANN.match(X_train, y_train, epochs=10)
ANN.consider(X_test, y_test)

CNN.match(X_train, y_train, epochs=10)
CNN.consider(X_test, y_test)

Coaching ANN Mannequin
Coaching CNN Mannequin

Outcomes Comparability

The analysis outcomes for each fashions present the accuracy and loss on the take a look at knowledge.

ANN Analysis

  • Accuracy: 0.4960
  • Loss: 1.4678
Take a look at Knowledge Analysis for ANN Mannequin

CNN Analysis

  • Accuracy: 0.7032
  • Loss: 0.8321
Take a look at Knowledge Analysis for CNN Mannequin

The CNN considerably outperforms the ANN when it comes to accuracy and loss.

Confusion Matrices and Classification Studies

To additional analyze the fashions’ efficiency, confusion matrices and classification reviews had been generated.

ANN Confusion Matrix and Report

y_pred_ann = ANN.predict(X_test)
y_pred_labels_ann = [np.argmax(i) for i in y_pred_ann]
plot_confusion_matrix(y_test, y_pred_labels_ann, "Confusion Matrix for ANN")
print("Classification Report for ANN:")
print(classification_report(y_test, y_pred_labels_ann))

CNN Confusion Matrix and Report

y_pred_cnn = CNN.predict(X_test)
y_pred_labels_cnn = [np.argmax(i) for i in y_pred_cnn]
plot_confusion_matrix(y_test, y_pred_labels_cnn, "Confusion Matrix for CNN")
print("Classification Report for CNN:")
print(classification_report(y_test, y_pred_labels_cnn))

Conclusion

The CNN mannequin outperforms the ANN mannequin on the CIFAR-10 dataset on account of its capacity to seize spatial hierarchies and native patterns within the picture knowledge. Whereas ANNs are highly effective for common duties, CNNs are particularly designed for image-related duties, making them simpler for this utility.

In abstract, for picture classification duties like these within the CIFAR-10 dataset, CNNs provide a big efficiency benefit over ANNs on account of their specialised structure tailor-made for processing visible knowledge.

Flip your Meta Quest into a large show for any HDMI system – here is how

0


meta-quest-hdmi-link

Meta

Ever want you had a large display on your gaming session or work challenge? When you’ve got a Meta Quest headset, you are in luck — now you can join it to just about any system.

Meta’s new app for the Quest headset, HDMI Hyperlink, turns your headset into a large display for any HDMI output-compatible system, together with media gamers, sport consoles just like the Nintendo Change or PS5, laptops, tablets, smartphones, and extra. 

Additionally: Meta Quest 3 is getting AI earlier than Apple’s Imaginative and prescient Professional does – here is the best way to allow it

The excellent news for older headset customers is that this app works on the Meta Quest 2, Quest 3, and Professional.

With HDMI Hyperlink, Meta says, you possibly can get pleasure from an enormous number of 2D content material in a 3D area in 1080p with virtually no latency. Nonetheless, it won’t work for films or exhibits. The corporate warns that sure apps, particularly streaming apps, make the most of built-in copy safety software program that will intervene with HDMI Hyperlink. 

In 2021, Meta launched a considerably related characteristic known as Air Hyperlink, which lets you join your Meta Quest wirelessly to your PC to play PC VR video games in your Quest. That characteristic solely works on PCs, although, and requires dependable Wi-Fi. This new characteristic works wirelessly however is open to all HDMI units, not simply computer systems.

There may be one small caveat. HDMI Hyperlink wants a little bit further {hardware} — a UVC- and UAC-compatible seize card and cables. Meta says that is “principally plug-and-play” however provides that it isn’t fairly as simple as Air Hyperlink. A fast search on-line exhibits a number of first rate choices for suitable playing cards underneath $30, so it is a comparatively inexpensive funding.

Additionally: This $50 Meta Quest 3 accent is a game-changer for folks with glasses

This is the best way to arrange HDMI Hyperlink in your Quest headset.

  • Set up the Meta Quest HDMI Hyperlink app.
  • Join your supply system to your seize card with an HDMI cable, USB-C-to-HDMI cable, or Lightning-to-HDMI cable.
  • It is elective however really useful to run USB-C energy to your seize card. If obtainable, this retains your headset charged throughout use.
  • Join your headset to the seize card utilizing a USB-A feminine to USB-C male cable.
  • Activate the headset and grant the Digicam and File Audio permissions.



Vine Connoisseur John Gulius Relishes the Richness of Natural Tomatoes


Tomatoes have at all times been central to good diet, nice delicacies, and at instances spirited debates over learn how to classify one in all nature’s most utilitarian wonders.

Years in the past, British journalist Miles Kington settled that query. “Information is understanding {that a} tomato is a fruit,” he wrote. “Knowledge shouldn’t be placing it in a fruit salad.”
We’re nonetheless studying from tomatoes, and about them. A major instance is a examine from a analysis workforce on the College of Barcelona that exhibits natural tomatoes are far more healthy than conventionally-grown varieties. The obvious motive: They’ve earned their nutrient-rich profiles the old style approach, within the day by day battle to outlive.

John Gulius, South Carolina’s landscaping and gardening professional, has lengthy recognized this about natural tomatoes. As he explains it, typical farming strategies have basically made fashionable tomatoes fats and lazy. Natural farming leads to a hardier tomato, a plant that depends on its pure defenses to thrive. Defensive compounds like polyphenols make the natural tomato a lot richer in vitamins than its chemical-fed cousins.

“It’s all about how onerous it’s for a plant to entry nitrogen,” he says. “With typical farming practices, particularly on farms owned by big agribusinesses, vegetation are regularly doused with nitrogen within the type of synthetic fertilizer. Natural farmers don’t layer their crops with synthetic compounds, and so the quantity of nitrogen is much less. This in flip triggers a pure protection reflex in vegetation which boosts ranges of vitamins, minerals and secondary metabolites. That’s not solely nice for the plant, however splendidly wholesome for these of us on the high of the meals chain.”

From his base in Greenville, John Gulius operates Carolina Turf Options, an organization that, in response to its web site, makes use of a “holistic method that integrates superior information, sustainable practices, and customized care to cater to the distinctive wants of every panorama.”

He believes a landscaper have to be an environmental steward, knowledgeable who understands what kinds of vitamins particular vegetation want, and during which proportion. With this data, Gulius is ready to make use of plant-based fertilizers in lots of conditions. He’s realized that by utilizing cowl crops, it’s doable to feed the expansion of vegetation with out constructing extra quantities of nitrogen and phosphorus within the soil.

Reporting on the Barcelona examine, Science Day by day reviewed the advantages of natural cultivation, which builds the character of the younger inexperienced orbs as they redden on the vine: “Natural tomatoes comprise increased ranges of phenolic compounds than typical tomatoes. Phenolic compounds are natural molecules discovered in lots of greens with confirmed human well being advantages. Polyphenols — pure antioxidants of plant origin — are thought-about to be of nice dietary curiosity as a result of its consumption is related to decreased danger of cardiovascular and degenerative ailments, and a few types of most cancers.”

College of Barcelona researcher Rosa M. Lamuela informed the publication: “The advantage of taking polyphenols by means of meals is that they comprise all kinds of such molecules, that are elevated. This might be extra useful to well being than the consumption of dietary supplements. Tomatoes additionally comprise lycopene and different carotenoids, and vitamin C.”

The College of Barcelona workforce discovered that these dramatic dietary variations are additionally obvious in tomato juice and ketchup. Whether or not in a consuming glass or condiment bottle, tossed in a salad or stewed in marinara sauce, the natural selection is richer, more healthy and extra flavorful — a tomato true to nature, and pleased with its roots.

Article Submitted By Neighborhood Author

Including values to the SwiftUI atmosphere with Xcode 16’s Entry macro – Donny Wals


Revealed on: July 15, 2024

Including customized values to SwiftUI’s atmosphere has by no means been very exhausting to do to. Nonetheless, the syntax for doing it’s verbose and simple to neglect. To refresh your thoughts, check out this publish the place I clarify the best way to add your personal atmosphere values to a SwiftUI view.

To summarize what’s proven in that publish; right here’s the way you add a customized worth to the atmosphere utilizing Xcode 15 and earlier:

non-public struct DateFormatterKey: EnvironmentKey {
    static let defaultValue: DateFormatter = {
        let formatter = DateFormatter()
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.dateFormat = "MM/dd/yyyy"
        return formatter
    }()
}

extension EnvironmentValues {
    var dateFormatter: DateFormatter {
        get { self[DateFormatterKey.self] }
        set { self[DateFormatterKey.self] = newValue }
    }
}

We’ve got to outline an atmosphere key, outline a default worth, and write a getter and setter to retrieve our worth from the atmosphere utilizing our key.

That is repetitive, simple to neglect, and simply annoying to do.

In the event you favor studying thorugh video, here is the video to look at:

Fortunately, in Xcode 16 now we have entry to the @Entry macro. This macro permits us to outline the very same atmosphere key like this:

extension EnvironmentValues {
    @Entry var dateFormatter: DateFormatter = {
        let formatter = DateFormatter()
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.dateFormat = "MM/dd/yyyy"
        return formatter
    }()
}

All now we have to outline now could be a variable that’s annotated with @Entry and we’re carried out.

The property title is used because the atmosphere key so on this case we’d set our date formatter like this:

myView
    .atmosphere(.dateFormatter, Dateformatter())

I completely love this new syntax as a result of it removes all of the boilerplate in a single go.

And the perfect a part of this macro?

We are able to use it in initiatives that focus on iOS variations older than 18! In order quickly as you begin growing your undertaking with Xcode 16 you’ll be capable to use this macro no matter your deployment goal.

GitHub Patches Vital Safety Flaw in Enterprise Server Granting Admin Privileges

0


Aug 22, 2024Ravie LakshmananEnterprise Software program / Vulnerability

GitHub Patches Vital Safety Flaw in Enterprise Server Granting Admin Privileges

GitHub has launched fixes to deal with a set of three safety flaws impacting its Enterprise Server product, together with one crucial bug that could possibly be abused to realize website administrator privileges.

Probably the most extreme of the shortcomings has been assigned the CVE identifier CVE-2024-6800, and carries a CVSS rating of 9.5.

“On GitHub Enterprise Server situations that use SAML single sign-on (SSO) authentication with particular IdPs using publicly uncovered signed federation metadata XML, an attacker might forge a SAML response to provision and/or achieve entry to a consumer account with website administrator privileges,” GitHub stated in an advisory.

Cybersecurity

The Microsoft-owned subsidiary has additionally addressed a pair of medium-severity flaws –

  • CVE-2024-7711 (CVSS rating: 5.3) – An incorrect authorization vulnerability that might enable an attacker to replace the title, assignees, and labels of any problem inside a public repository.
  • CVE-2024-6337 (CVSS rating: 5.9) – An incorrect authorization vulnerability that might enable an attacker to entry problem contents from a personal repository utilizing a GitHub App with solely contents: learn and pull requests: write permissions.

All three safety vulnerabilities have been addressed in GHES variations 3.13.3, 3.12.8, 3.11.14, and three.10.16.

Again in Could, GitHub additionally patched a crucial safety vulnerability (CVE-2024-4985, CVSS rating: 10.0) that might allow unauthorized entry to an occasion with out requiring prior authentication.

Organizations which might be working a susceptible self-hosted model of GHES are extremely suggested to replace to the newest model to safeguard towards potential safety threats.

Discovered this text fascinating? Comply with us on Twitter and LinkedIn to learn extra unique content material we submit.