Recognizing numbers 1-10
Worksheets | TPT
by
My Nerdy Teacher by Alina V
$100.00
$19.00
⭐⭐⭐ FLASH SALE ⭐⭐⭐Grab The Ultimate Reading Intervention Mega Bundle FOR JUST $19! ($100 VALUE)Are you looking for some fun and engaging Reading Intervention activities aligned with Science of Reading?Grab The Ultimate Phonics Reading Intervention MEGA BUNDLE for just $19! Hurry up, time is running out! Your students will become fluent readers using these fun activities.Low Prep Required. Simply print and go.These activities will help your students practice the phonics patterns you're teaching
Subjects:
Phonics, Reading, Writing
Grades:
PreK - 1st
Types:
Activities, Centers, Printables
CCSS:
RF.K.1, RF.K.1a, RF.K.1b, RF.K.1c, RF.K.1d…
by
My Nerdy Teacher by Alina V
$100.00
$19.00
⭐⭐⭐ FLASH SALE ⭐⭐⭐Grab The Decodable Readers Passages Mega Bundle for just $19! Hurry up, time is running out! Your students can practice reading in a fun and engaging way using these decodable texts. Science of Reading AlignedLow Prep Required. Simply print and go.These decodable passages will help your students practice the phonics patterns you're teaching them.Perfect for centers, homework, morning work, and more.Printable and Digital (Google Slides™)Perfect for Preschool Kindergarten, 1st gr
Subjects:
Phonics, Reading, Writing
Grades:
K - 2nd
Types:
Activities, Centers, Printables
CCSS:
RF.K.2d, RF.K.3, RF.K.3c, RF.1.2c, RF.1.2d…
by
Read Write Middle
In this engaging activity, students make inferences and draw conclusions by analyzing a variety of text message conversations. Students are required to cite evidence for each answer.Digital & Printable Options: This product now includes a Google Slides option as well as a printable PDF.This product also includes a page that has two blank phone conversations.Students love the text message layout! This is a great way for older students to practice making inferences and citing evidence in a for
Subjects:
Reading
Grades:
5th - 7th
Types:
Printables, Worksheets
CCSS:
RL. 5.1, RL.6.1, RL.7.1
Also included in: Text Message Analysis Bundle Making Inferences & Citing Evidence
by
Digital Divide and Conquer
If you’ve been watching TV or reading magazines, chances are you've seen a tiny house. These little homes are everywhere...and now, we're asking students to make their own 3D version! Build A Tiny House is a project based learning (PBL) activity that'll put the designing into the hands of the students. Students will dive deep to show they understand the how (and why) math concepts such as area, perimeter, and geometry are used in building a home. This project integrates multiple elements such a
Subjects:
Math, Measurement, Special Education
Grades:
2nd - 7th
Types:
Activities, Projects
Also included in: The Project Based Learning Bundle! 14 PBL Activities
by
My Teaching Pal
$22.00
$15.00
Bundle
This bundle features a HUGE 263 math worksheets for first grade! The worksheets cover addition and subtraction, numbers and place value, 2D & 3D shapes, data and graphing, fractions & partitioning and time. These fun-filled worksheets are great to use all year round and they are perfect for whole-class activities, math stations, fast finisher activities, homework and review. This bundle consists of the following packets:First Grade Addition and Subtraction WorksheetsFirst Grade 2D and 3D
Subjects:
Basic Operations, Math, Numbers
Grades:
Types:
Printables, Workbooks, Worksheets
by
A Teachable Teacher
$25.00
$20.00
Bundle
All-in-One Reading Passages give your students the opportunity to practice phonics and fluency with these reading comprehension passages and questions. The best part? It requires no prep on your end! Now including original PDF + NEW digital versions of each phonics reading passage for distance learning!Each reading passage gives your students the opportunity to practice a targeted phonics skill in the context of reading. Each phonics passage also builds fluency and comprehension. It’s the bundle
Subjects:
ELA Test Prep, Phonics, Reading
Grades:
1st - 2nd
Types:
English (UK), Guided Reading Books, Printables
by
Aimee's Edventures LLC
$10.75
$5.50
It was breaking my heart to watch my students wandering around the room trying not to cry when I said, "Please find a partner." So I created these cards! Now they are loved by thousands of teachers who have the same goal of including every student in their classroom.These partnership cards make it quick and easy to set up differentiated small group work, and they're perfect for kids of all abilities. The best part is that they don't have to guess who their partner is, it's right on the card (whi
Subjects:
Back to School, Classroom Community, Classroom Management
Grades:
Not Grade Specific
Types:
Activities, Games, Printables
Also included in: Classroom Management BUNDLE
by
ThatKinderMama
$10. 00
This is a four week illustration unit to help kindergarten/first grade writers become confident in their drawing and coloring skills. Primary students will learn how to draw with shapes and people with different facial expressions, hairstyles, and skin tones.This illustration study sets kindergarten students up for success for the rest of the year during writers workshop. Students can reference their directed drawing notebook throughout the year if they forget how to draw an object already taugh
Subjects:
Arts & Music, Back to School, Writing
Grades:
PreK - 1st
Types:
Lesson, Printables
Also included in: Kindergarten Writing Units GROWING BUNDLE | Writers Workshop
by
Teaching With a Mountain View
Informational Text Reading Skills and Close Reading Task Cards for Comprehension Skill ReviewEngage your readers with high-interest reading comprehension passages and corresponding questions! This resource includes 32 half-page informational text task cards with 4 comprehension questions and tasks on EACH card for a total of 128 informational text questions! Engage your students in meaningful close reading practice and review key reading skills associated with informational and nonfiction text
Subjects:
ELA Test Prep, English Language Arts, Informational Text
Grades:
3rd - 5th
Types:
Centers, Task Cards
CCSS:
RI. 3.1, RI.3.2, RI.3.3, RI.3.4, RI.3.5…
Also included in: Reading Comprehension Task Card Bundle | Digital and Printable
by
Dana's Wonderland
This product contains 21 reading comprehension passages with questions that target fluency and comprehension. The 21 reading passages are presented twice, in 2 versions, for easy differentiation. The passages can also be used digitally as an Easel activity.Version 1 asks the kids to answer each question in a complete sentence and color the evidence in the text. Version 2 teaches the kids to look in the text and find the text evidence without writing a sentence.The students will have to:*read the
Subjects:
Close Reading, English Language Arts, Reading
Grades:
1st - 2nd
Types:
Graphic Organizers, Guided Reading Books, Printables
CCSS:
RL.1.1, RL.1.10, RL.2.1, RL.2.10, RI.1.1…
Also included in: Reading Comprehension Passages and Questions BUNDLE
by
Lucky Little Learners
This pack of handwriting pages gives your students the handwriting practice they need in an engaging way. They will build writing stamina, review letter & number formation, and practice sight words while learning new jokes and fun facts!⭐️DOWNLOAD THE PREVIEW FILE TO SEE THIS HANDWRITING RESOURCE IN DETAIL⭐️Read more about how I use handwriting practice sheets here.Need letter & handwriting practice that’s not “baby-ish?”The silly jokes and fun facts will engage your students while they
Subjects:
Balanced Literacy, Handwriting, Writing
Grades:
1st - 3rd
Types:
Independent Work Packet, Printables, Worksheets
by
Miss McRaes Teaching Tales
Are you looking for a quick and easy classroom management tool and also to easily send parents, guardians, and families home a positive note? Happy Mail is the perfect tool to communicate to families about their learner's behavior at school. This is a quick, easy and effective way to accomplish parent communication in your classroom! Students also LOVE receiving happy mail in the classroom, to be recognized for their positive actions. What is Included?5 templates of happy mail (no box, box, bla
Subjects:
Classroom Community, Classroom Management
Grades:
Not Grade Specific
Types:
For Parents, Printables
Also included in: Parent Communication Bundle | Happy Mail | Monthly Newsletter
by
Mrs Ds Corner
$15.00
$10.00
NUMBER 1 BEST SELLER ON TPT * Functional, differentiated skill work that is the perfect addition to your morning routine and calendar time. This adapted binder will help your students start their day off right, and once mastered, can be a set of skills they complete successfully and independently. Please watch the video preview for a look at some of the workpages included in this resource.Watch a video preview here.See it in action here and here. What is included?• 8 editable covers (add student
Subjects:
English Language Arts, Math, Special Education
Grades:
PreK - 4th
Types:
Activities, Interactive Notebooks, Printables
Also included in: BUNDLE Morning Adapted Work Binder® ( English and Spanish )
by
Especially Education
If you are looking for an individual schedule book, visual schedules, or a first then board, this Positive Behavior Support resource has it all! Please note: All editable files are compatible with Microsoft PowerPoint. Some pages may now be edited using Google Slides.Included in this download: - 6-tabbed and 2-tabbed flip book options- 200+ visual schedule icons (these are not editable)- First then board (separate from flip book)- First next then board (separate from flip book)- Token boards (wi
Subjects:
Back to School, Special Education, Speech Therapy
Grades:
PreK - 2nd
Types:
Activities
Also included in: BUNDLE: First Then Board & Visual Schedule Flip Books (clipart + real pictures)
by
Patricia Pat Resources
Is writing complete sentences or sentence structure a struggle for your students? If so, you’ll love how these sentence building worksheets will help you teach how to write complete sentences.✏️ The many visuals in the worksheet will help your students COMPREHEND and REMEMBER the correct sentence structure. ✏️ This is a no-prep resource that even reluctant writers will love, plus you will save a lot of time with THREE Differentiations and Scaffolding done for you. ✏️ These hands-on worksheets wil
Subjects:
EFL - ESL - ELD, English Language Arts, Special Education
Grades:
K - 2nd
Types:
Centers, Homeschool Curricula, Homework
CCSS:
RF.1.1a, SL.1.6, L.K.1f, L.1.1c, L.1.2b
Also included in: Sentence Writing Center | Complete Sentences | Sentence Structure | Small Groups
by
Simply Kinder
$972.00
$25.00
The ultimate bundle for kindergarten sight word practice books, games, color by code, and more for 200+ high-frequency words! BEST SELLER on TpT with over 7,000 teacher reviews! Check out this incredible value for everything you need for sight word practice!Your Sight Word Practice just became so much better with this huge file of printables, activities, centers and so much more. Each sight word included has its own separate file with 67 pages of activities! Perfect for kindergarten, first grad
Subjects:
English Language Arts, Reading
Grades:
PreK - 1st
Types:
Activities, Printables, Worksheets
CCSS:
RF. K.2, RF.K.3, RF.K.3c
by
Rachel Lynette
$14.98
$9.98
Paragraph writing just got easier! Whether you need print or digital, these ready-to-use pages (and slides) are an effective way to help your students learn all about writing a paragraph.WHAT’S INCLUDED:✍️ PRINT:60 different writing prompts (20 opinion, 20 informative, & 20 narrative)Brainstorming PagesOrganizing and Planning PagesFirst Draft PagesRevision & Editing PagesFinal Draft PagesPublishing PagesDIGITAL:Google SlidesEasel ActivityDIFFERENTIATION OPTIONS:Digital or PrintParagraph
Subjects:
Writing, Writing-Essays, Writing-Expository
Grades:
3rd - 5th
Types:
Independent Work Packet, Worksheets
CCSS:
W.3.1, W.3.2, W.3.3, W.3.4, W.3.5…
Also included in: Paragraph Writing of the Week - Differentiation Bundle for Grades 2-3
by
The Daring English Teacher
$43.25
$23. 50
Bundle
Teach your students how to write an essay! This comprehensive essay writing bundle includes teaching resources and lessons for every part of an essay. First, focus on teaching the thesis statement and introductory paragraph.The first writing unit includes targeted teaching strategies to teach students how to write a thesis statement and an introduction to an essay. This thesis writing teaching unit includes a teaching presentation (PowerPoint and Google Slide) for direct instruction. This teachi
Subjects:
English Language Arts, Writing, Writing-Essays
Grades:
6th - 10th
CCSS:
W.7.1, W.7.2, W.7.4, W.7.5, W.8.1…
by
Pathway 2 Success
$14.00
Use these lessons to get kids' self-control skills in shape! Activities focus on understanding self-control, impulse control, stopping and thinking to make a decision, waiting our turn, following rules and directions, staying motivated, doing our best work, managing emotions, using coping strategies, and practicing self-control to strengthen skills over time. Other skills that impact self-control are also addressed, including planning, time management, and perseverance.Digital VersionUpdated to
Subjects:
School Counseling, Social Emotional Learning, Special Education
Grades:
4th - 8th
Types:
Lesson, Printables
by
Kim Miller
Are you having a hard time teaching your students how to find the main idea and supporting details of a passage? Many students struggle with this skill. They tend to get confused and caught up in all the little details. These reading passages with graphic organizers are perfect for students to use as they practice finding the main idea and supporting details. After years of trial and error, I have found that this solution works time and time again.These PRINT & DIGITAL main idea practice act
Subjects:
English Language Arts, Informational Text, Reading Strategies
Grades:
3rd - 5th
Types:
Printables, Worksheets
CCSS:
RI. 3.2, RI.4.2, RI.5.2
Also included in: Main Idea & Supporting Details Activities Graphic Organizers Central Idea Bundle
by
Miss Kindergarten Love
$18.00
$15.00
A fun way to help your students develop number recognition! These number practice printables are a fun way to help your little learners practice number formation, number sense, and number recognition. Help your Pre-k, kindergarten, and first grade students with a fun and engaging ways to practice building number sense while identifying, writing, and counting numbers to 50. ⭐️BUNDLE & SAVE⭐️Grab these no prep printables PLUS even more number sense activities with the Number Centers and Number
Subjects:
Math, Numbers
Grades:
PreK - 1st
Types:
Centers, Printables, Worksheets
Also included in: Kindergarten Math Number Sense Activities & Centers Bundle
by
Lucky Little Learners
$34. 00
$23.00
Bundle
Phonics reading passages, or Phonics Mats, are the perfect no-prep, print and go resource to help students turn isolated phonics skills into reading text! Students practice isolated phonics skills, decoding, fluency, and comprehension all in one resource. *** NEW UPDATE *** This resource has been updated with a brand new 2022 version! The new phonics mats have decodable passages, comprehension questions, word writing practice, and a warm-up page for each skill. Make sure to download the preview
Subjects:
Phonics, Reading, Writing
Grades:
Types:
Printables, Worksheets
CCSS:
RF.2.3, RF.2.3a, RF.2.3b, RF.2.3c, RF.2.3d…
by
Karen Jones
$10.00
One of TPT's top selling phonics resources! This pack contains over 100 pages of printable phonics worksheets that are ready-to-use! No prep work required, just print and copy! Each page is a stand alone activity that your students can work on independently. They work great for word work practice, morning work, literacy centers, or homework. Each page includes some interactive element of cutting and gluing, coloring, or sorting. A PowerPoint version and Image files are also included for uploadi
Subjects:
English Language Arts, Phonics
Grades:
K - 1st
Types:
Activities, Centers, Printables
CCSS:
RF.K.2a, RF.K.2b, RF.K.2c, RF.K.2d, RF.K.3…
by
My Teaching Pal
This packet is jammed full of addition and subtraction worksheets to help your students master the basic facts. It includes 36 engaging worksheets which cover both addition and subtraction facts up to 10. Students will be practicing picture addition/subtraction, using number lines, finding missing addends, making ten and so much more! It is perfect for whole-class activities, math stations, fast finisher activities and review.Save 30% with the bundle!Kindergarten Math Worksheet MEGA BundleThe wo
Subjects:
Basic Operations, Math, Word Problems
Grades:
PreK - 1st
Types:
Centers, Printables, Worksheets
Also included in: Kindergarten Math Worksheet Bundle - Addition, Subtraction, Place Value, Shapes
Browse Identifying Numbers 0-10 Educational Resources
Entire LibraryPrintable WorksheetsGamesGuided LessonsLesson PlansHands-on ActivitiesInteractive StoriesOnline ExercisesPrintable WorkbooksScience ProjectsSong Videos
345 filtered results
345 filtered results
Identifying Numbers 0-10
Sort byPopularityMost RecentTitleRelevance
-
Filter Results
- clear all filters
By Grade
- Preschool
- Kindergarten
- 1st grade
- 2nd grade
- 3rd grade
- 4th grade
- 5th grade
- 6th grade
- 7th grade
- 8th grade
- English Learner (EL)
By Subject
- Coding
- Fine arts
- Foreign language
Math
Number Sense
Numbers 0-10
- Counting Numbers 1-10
Identifying Numbers 0-10
- Comparing Numbers 0-10
- Ordering Numbers 0-10
- Writing Numbers 0-10
- Numbers 11-20
- Two-Digit Numbers
- Three-Digit Numbers
- Multi-Digit Numbers
- Number Patterns
- Number Theory
- Exponents
- Roots
- Scientific Notation
- Integers and Rational Numbers
- Irrational Numbers
- Addition
- Subtraction
- Multiplication
- Division
- Mixed Operations
- Fractions
- Decimals
- Percents, Ratios, and Rates
- Algebra
- Geometry
- Measurement
- Time
- Money Math
- Data and Graphing
- Math Word Problems
- Math Puzzles
- Reading & Writing
- Science
- Social emotional
- Social studies
- Typing
By Topic
- Arts & crafts
- Coloring
- Holidays
- Offline games
- Seasonal
- Teacher Resources
By Standard
- Common Core
Counting 1
Guided Lesson
Counting 1
Teach preschoolers the skills necessary for learning how to count with this guided lesson. Kids learn one-to-one correspondence and how numerals relate to quantity. They also learn how to count out a given number of objects using both manipulatives and one-to-one correspondence. With scaffolded learning techniques that help kids build skills, as well as opportunites to practice these skills within a narrative, this lesson has counting covered.
Preschool
Math
Guided Lesson
Search Identifying Numbers 0-10 Educational Resources
If your student is still mastering her 123s, color by number is more than just a fun way for her to pass time. Completing these color by number and connect the dots worksheets will help your student identify numbers 1-10. Lesson plans will also help you teach this fundamental math skill. For more counting practice, check out our counting numbers 1-10 resources.
Easy as 123: Resources on Identifying Numbers 0-10
Counting to 10 is a child's first experience with math. There are numerous tools in the Learning Library to help young learners identify these important numbers and commit this rudimentary skill to memory.
There are multiple teacher-created lesson plans that teach children number recognition. Five Busy Little Bees is a popular plan that is a close look at numbers 1-5. Students will learn how to identify and write 1, 2, 3, 4 and 5 with the help of colorful bumblebee cutouts. Leafy Numbers utilizes fresh fallen leaves from a tree to help students count all the way to 15. All of the lesson plans are complete with guided instruction. The plans include a group lesson as well as opportunities for independent working time. For students who grasp counting quickly, each plan includes enrichment options, too.
Catchy songs are always helpful when it comes to memorization. The library offers three song videos that kids enjoy singing along with. There is also a selection of professional online games including puzzles and a matching game that are both academic and entertaining. There are many other options available for parents and teachers to help students begin their math journey on the right foot. The Learning Library resources on identifying numbers 0 through 10 make learning to count as easy as 123.
How to teach a child to recognize numbers from 1 to 10 | Lifestyle
Number Recognition - The ability to visually recognize numbers and then name them. For example, number recognition allows the child to understand that the symbol 2 refers to the word "two" as well as the corresponding number. To teach your toddler to recognize numbers from 1 to 10, start by sequentially describing your child's environment using numbers. You can include numbers in a sensory game or arrange games to help your child understand this important concept.
Children's introduction to numbers
Use numbers to describe your child's groups of things. To create a foundation for number recognition, talk about your child's environment in terms of numbers. If several pencils have fallen on the floor, you can say, “Oh, I dropped 3 pencils!” Or, while reading a picture book, you can point to an illustration and say, "There are 2 planes in the sky."
Be sure to use numbers when describing situations in which your child had a hand in creating something. For example, if he drew 4 chicks, you could point to that and ask, "Are you going to draw 4 more chicks?" Start with smaller numbers, usually up to 4-6. Young children may be confused by large numbers at first.
Put numbers on houses, street signs or other places
This will help your child start to recognize different numbers. When you drive or walk around your neighborhood, pay attention to your child, for example, by house numbers or phone numbers on billboards. While at home, enter numbers on telephone keypads, remote controls, clocks, or thermometers. Be consistent in your use of numbers in everyday conversation. The more often you use numbers to describe things and indicate numbers in your child's environment, the faster he will recognize numbers.
Have the children do their homework using numbers
Children need to understand that numbers are not just for math class. They can also be used in real situations. For example, ask your child for lunch to indicate the correct number of napkins for your family. Or in an arts and crafts class, ask for enough glue sticks for each person at the table. These kinds of requests will encourage your child to view their world in terms of numbers. This helps lay the groundwork for more complex concepts.
Adding numbers to the sensory game
Buy sets of magnetic numbers and have your child match them. Let your child play freely with them first so that they start to recognize the shapes of the different numbers. Then ask him to match pairs or groups with the same number. If the child is older, see if he can put the numbers in order. Magnetic numbers can be attached to the refrigerator door or on a baking sheet.
Drawing numbers on flour
Sprinkle a thin layer of flour on a tray or baking sheet. Then have your child draw different numbers on it. If your child is just getting started with number recognition, you can write an example of each number on a piece of paper. Once the tray is filled with numbers, help your child even out the flour so he can keep drawing.
Reproduce the shape of the numbers
Write the numbers 1 through 10 on a large piece of paper. Then cut several pieces of thread of different colors and different lengths. Have your child arrange the strings so that they follow the shape of the numbers on the paper. You can even glue threads to it if you like.
Button sorting
Write the numbers 1 to 10 on 10 plastic cups. Then give your child some buttons or other small items (such as shells or pebbles). Ask them to place the correct number of items in each labeled glass. Whatever items you use, make sure they are large enough so that your child cannot, for example, swallow them or stick them up their nose. This can be a great activity for several kids to play together. If one child has mastered the rules, he can help his playmates who are still learning to recognize numbers.
Use the calculator to experiment.
Ask your child to find the number that tells them how old they are. Ask them to enter numbers from 1 to 10 in the correct order. The calculator can be used anywhere. Keep it in your pocket or bag so you can take it out while waiting in line.
Number recognition practice with games and activities
For the first game you will need 1 die, piece of paper, pencils, 6 tokens per player and a number line from 1 to 6 for each player. One player rolls the die and places a token on that number on their number line. The other player does the same. If any player rolls a number that is already covered by the token, he skips the turn. The first one that occupies all 6 numbers wins the game. You can also use a number line from 1 to 12 for older children and roll two dice instead of one.
Match the numbered cards until you have completed the entire deck.
Take the numbered cards. Have your child turn over the first card in the deck. Then ask to turn over the next card. If its number matches the number of the first card, they must be placed side by side, if not, put aside. For this game, you can use a deck of ordinary playing cards, taking out cards with pictures.
Speed Game
You will need a deck of 10 cards for each player. You can make them yourself. Numbers must be drawn on the cards (from 1 to 10). Each player must shuffle their deck and place it face up in the pile. Then, at the command of an adult, the children should begin to sort their cards, arranging them in the correct sequence. The first player to do it right wins. But don't stop playing there. All players must finish laying out their cards. You can play this game multiple times in a row so your kids can develop better sorting and ordering strategies. You could even invite your child to play this game on their own - just keep track of the time it takes them to complete the task.
Number line and blocks
Make a long, straight line on the floor using masking tape. Add 10 shorter horizontal pieces of ribbon evenly spaced along the line. Label each short piece of tape with a number from 1 to 10. Then ask your child to place 1 block on the line next to the “1” mark, 2 blocks on the line next to the “2” mark, etc. If your child does not recognize numeric characters, but knows the names of the numbers, try starting at 1 and have it count as they move up the number line. This will help the child understand, for example, that the symbol "8" corresponds to the word "eight". If you have a younger preschooler, you can start with numbers 1-5 and then work on.
Tower of blocks
The essence of the game is that you need to roll a die, then build a tower of blocks using the number of points dropped. Choose a die with symbols on the side, not dots. Make this game more challenging by taking turns and adding to your tower each turn until you get to 10. For example, your child rolls a "2" and builds a 2 block tower. You roll a "4" and stack 4 blocks to create your tower. Your child throws again and gets a "6". He then counts 6 additional blocks to add to his original tower for a total of 8 blocks. Keep playing until both of your towers are 10 blocks high.
Digit recognition, for the smallest possible (python / keras) / Sudo Null IT News start playing with the code. But I didn't find it. For you friends!
P.S all code will be at the end.
Import keras backend, at first we won't use it, but we need some functions
import tensorflow as tf
We import the machine learning package itself, and we will use it.
import keras
Math functions that we will also need.
import numpy as np
Library for displaying images.
import matplotlib.pyplot as plt
What is this line for? - google yourself.
%matplotlib inline
Import layers, or rather layer classes, for our neural network.
from keras.layers import Dense, Flatten
Import of our serial model.
from keras.models import Sequential
Importing the MNIST dataset for our training.
from keras.datasets import mnist
We load data using the load_data function from the name of our mnist dataset and divide our dataset into a training sample and a test one.
(X_train, y_train), (X_test, y_test) = mnist.load_data()
Let's see what kind of images we have and what form they are in.
print(X_train.shape)
Here we see that X_train is an array of data with 60000 instances of pictures that have a resolution of 28 by 28.
Now let's see what y_train is.
print(y_train.shape)
We see that this is just an array of 60000 values and nothing more.
And now let's see what exactly is stored in arrays, if X_train is an array of images, let's open one!
We display 12th image from the array, and this is the number 3
plt. imshow(X_train[12], cmap='binary') plt.axis('off') print(y_train[12])
Here we see the number 3 and the picture with the number 3!
As you all know, the pixel value can be from 0 to 255, and if we feed such data into the neural network. A pixel with a value of 0 and a pixel with a value of 255 have very different value scales. It will be very difficult for us to learn the model.
And in order to "normalize" them so that they are ideally from 0 to 1, we will divide all our "good" by 255.
0 / 255 = 0, 255 / 255 = 1, and any number between 0 and 255 will just be a fraction.
X_train = X_train/255 X_test = X_test/255
This is what we got:
print(y_train[0])
y_train = keras.utils.to_categorical(y_train, 10) y_test = keras.utils.to_categorical(y_test, 10)
Result:
print(y_train[0])
Now let's write the neural network model itself.
We initialize our model.
model = Sequential()
Next, we create our first layer, it will have 32 neurons, and we also need to specify the shape of the input data.
model.add(Dense(32, activation='relu', input_shape=(X_train[0].shape)))
Next we create 4 neurons with the same activation function.
model.add(Dense(64, activation='relu')) model.add(Dense(128, activation='relu')) model.add(Dense(256, activation='relu')) model.add(Dense(512, activation='relu'))
We are pulling data into a vector.
model.add(Flatten())
And here we are comparing vector with vector, in fact it is.
model.add(Dense(10, activation='sigmoid'))
Here we compile our model, the optimizer is adam, because it is very "cool", "categorical_crossentropy" - because we define categories of objects.
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
Now train the model:
model.fit(X_train, y_train, epochs=50 )
We have trained our neural network and now let's look at the result.
We will use the "model. evaluate" command, if we translate literally - model.evaluate
It accepts a test dataset and see what kind of loss and what kind of accuracy:
As we can see, the accuracy is 96%.
Let's create a variable k and write the number of the image in the dataset there and call it.
They indicated the number 6, so the number 4 is under the index 6.
k = 6 plt.imshow(X_test[k], cmap='binary') plt.axis('off') print(y_test[k])
Let's put index 10, we get 0.
k = 10 plt.imshow(X_test[k], cmap='binary') plt.axis('off') print(y_test[k])
Now let's see how exactly our neural network works.
k = 6 plt.imshow(X_test[k], cmap='binary') plt.axis('off') print(y_test[k]) print( model.predict(np.array([X_test[k]])) )
[0. 0. 0. 0. 1. 0. 0. 0. 0. 0.] - one under index 4, respectively - number 4.
Visually in the picture we also see the number 4.
Now let's look at the answer of the neural network:
[[0. 0000000E+00, 9.9408084E-18, 2.8947007E-22, 2.9116518E-10, 1.0000000E+00,
4.6417094E-17, 3.77731555E-38, 5.8520163E-07 , 3.7786970E-24, 4.3130936E-07]]
*-letter E this is the value of the degree, consider the number-4.6417094E-17
number 4.6417094EE -17 is conventionally 4.6427 minus 17 degrees, it is approximately 0.00000000000000004642, that is, a very small number.
Let's look at the whole array and see that there is a number 0 to the 0th power, numbers to a negative power, and that we need 1 to the power of 0, any number to the zeroth power is equal to one.
The maximum element of the array under index 4, respectively, the number is 4.
Let's change the index and see what happens.
k = 10 plt.imshow(X_test[k], cmap='binary') plt.axis('off') print(y_test[k]) print( model.predict(np.array([X_test[k]])) )
Here we see that, based on the powers and numbers, we see that the larger number is under the index 0, respectively, and the number 0.
I hope you liked my post and it will be useful for you, here is all the code to insert into google colab:
import tensorflow as tf import keras import numpy as np import matplotlib.pyplot as plt %matplotlib inline from keras.layers import Dense, Flatten from keras.models import Sequential from keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.load_data() print(X_train.shape) print(y_train.shape) plt.imshow(X_train[12], cmap='binary') plt.axis('off') print(y_train[12]) X_train = X_train/255 X_test = X_test/255 print(y_train[0]) y_train = keras.utils.to_categorical(y_train, 10) y_test = keras.utils.to_categorical(y_test, 10) print(y_train[0]) model = Sequential() model.add(Dense(32, activation='relu', input_shape=(X_train[0].shape))) model.add(Dense(64, activation='relu')) model.add(Dense(128, activation='relu')) model.add(Dense(256, activation='relu')) model.add(Dense(512, activation='relu')) model.add(Flatten()) model.add(Dense(10, activation='sigmoid')) model.