Trending November 2023 # Using Social And Emotional Learning To Connect With Middle School Students # Suggested December 2023 # Top 19 Popular

You are reading the article Using Social And Emotional Learning To Connect With Middle School Students updated in November 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested December 2023 Using Social And Emotional Learning To Connect With Middle School Students

Activities that help students examine their thoughts and feelings and those of others can lead to stronger bonds with peers and teachers.

In certain spaces where I coach teachers, some students struggle to connect, interact, and socialize appropriately with peers and their teachers, even in the latter part of the second semester. These struggles can significantly disrupt the learning process, making effective teaching impossible when unchecked or unremedied. 

Some of the disruptions to teaching and learning I’ve encountered this school year include the following: 

Interruptions where teachers are unable to facilitate entire lessons

Vulgar verbal aggressions

Prevalent bullying, causing some students not to participate in classroom discussions or seek assistance from their teacher out of fear of being ridiculed and harassed by peers

Decreased focus and motivation levels for learning due to vaping and various forms of substance abuse 

Some root causes found in the literature for youth exhibiting difficult behaviors suggest the following: 

Unfortunately, teachers in some communities across the United States have reported increasing levels of frequent opposition and social and emotional disconnection among students in recent years. 

This type of behavior burdens teachers by putting them under enormous pressure to support kids in ways beyond teaching—especially when dealing with problematic students lacking parental or caregiver involvement. Sometimes these situations can seem hopeless, but we can take steps to improve relationships to empower willing students and appeal to those who may not immediately see a need for change.  

Concerned about her students, my collaborator, the principal of William Wirt Middle School, Rhonda Simley, expressed, “Our kids are hurting. Many are using substances to numb their pain. We must provide hope and begin planting the right seeds immediately. We know it’s hard for our teachers to implement SEL [social and emotional learning], but modeling for them with students may give them needed perspective.” 

Together, we created a youth empowerment SEL program at the school. We meet with the student body twice a month during enrichment time to engage them in meaningful discourse about issues relevant to them. We also use these sessions to strengthen their student portfolios with a kit of SEL tools and other life skills resources we model and teach them to use. Then we give them time to practice using the tools and provide feedback and emotional support as needed. 

Our program prioritizes two powerful activities that help learners begin to develop essential SEL skills. First, we have them compose personal narratives to explore knowledge of self and develop better self-awareness. Second, we use empathy mapping to have them cultivate social awareness and begin to put themselves in a classmate’s or teacher’s shoes. 

Here are some general guidelines and student handouts for implementing these two activities. 

Developing Introspection by Writing Personal Narratives 

Encourage learners to focus on understanding and appreciating themselves through a personal narrative—doing so will make it easier for them to make better efforts to understand others. Emphasize that having knowledge of self means having insight into one’s identity, and self-awareness means comprehending the reasons for our actions. 

Students compose an original personal narrative of about 250 words describing things they know about themselves or a particular event or hobby they enjoy (e.g., a sport they play, an artistic skill, or their special talent). They may also include aspects of their culture at home (e.g., music, food, holidays, languages they speak, religion, etc.) or a future goal. The narrative should also provide the following: 

Adherence to good grammar and sentence structure.

Clear organization with a start, middle, and end. 

Takeaways on what they know better about themselves. 

When we introduced this activity, my colleague Ezekiel Valenga and I wrote and read our own personal narratives to inspire and motivate students. One class needed external inspiration, so we had them read the lyrics to 2Pac’s song “Keep Ya Head Up.” 

Developing Social Awareness with Empathy Mapping 

Students can create an empathy map as a helpful tool for being kind and connecting better with others by understanding how they may feel. 

Students may choose a classmate, a teacher, or someone else in their life as the subject of their map. Some may not feel comfortable choosing a person, and that’s OK. In these situations, I request them to choose a literary character or one from their favorite movie or television show. To create their empathy map, students will consider something the other person said and did in a particular situation and then imagine themselves as that person and think about what they might think and feel. 

Begin by explaining the importance of social awareness for fine-tuning relationship skills and providing students with a completed example of an empathy map. The teacher then pairs students and introduces a template with the following four quadrants:

Using sticky notes or free-handing on each quadrant, the learners will pay close attention to what their subject says and does. The “What I heard” quadrant should have actual quotes from their classmates. For example, a peer may say, “I like to complete my work by myself.” By paying close attention to behavior and actions, the learners should state only what they saw done in the “What I saw” quadrant. Doing so will give them context for what they believe the person thinks and feels. 

You can learn more about SEL activities in my book Raising Equity Through SEL.

I sincerely thank Rhonda Simley for jump-starting and including me in the Wirt Middle School SEL youth empowerment program, which became the impetus for this work. And special thanks to Ezekiel Valenga for teaching me the “personal narrative” activity. 

You're reading Using Social And Emotional Learning To Connect With Middle School Students

Boosting Students’ Literacy Skills With Help From The School Librarian

Raising literacy levels has always been a priority for schools, and even more so since the pandemic. Literacy is a fundamental skill that can be applied across all academic subjects. As we know, students who are literate are more able to engage with and understand the information they are being given or find for themselves and, in turn, are able to gain a deeper understanding of each subject. It’s widely recognized that a student who is literate is more likely to become a confident, self-motivated independent learner. 

School librarians have always had a role to play in promoting literacy—especially through reading for pleasure—and because of this, it’s often linked to the English department. This is not something that should be dismissed. As we know, students who read widely do better academically, as it introduces them to lots more vocabulary and also supports and engages their imagination. 

The Librarian’s Role Can Support Policy Development

However, the conversation around literacy seems to have changed over the last few months. There’s far more talk about literacy across the curriculum and the need to create cross-school literacy policies. I feel that this is a massive opportunity for the school librarian to demonstrate their role in the wider context. 

School librarians have always been a cross-curricula resource. They provide physical and online resources to meet the needs of the teachers and students, but they are also able to teach information literacy skills (including academic reading) through inquiry across all subjects. School libraries and librarians should be included in these policies in order to help teachers understand their wealth of expertise and remind them that the school librarian is there for everyone. 

Harness Librarians’ Expertise in Academic Reading

There are three aspects to raising literacy levels: first, teaching children how to read; second, supporting those students who need extra help through interventions; and finally, helping students to read academically—the skill that school librarians have the expertise to support. 

Academic reading comprises three tiers of vocabulary: 

Tier 1: This level includes everyday words that children come across regularly through reading; conversations with their peers; listening to the world around them; watching TV, YouTube, TikTok, etc., such as happy, baby, table, and cloth. 

Tier 2: This level relates to academic vocabulary that appears frequently across content areas, such as analyze and evaluate. 

Tier 3: This is subject-specific vocabulary, such as quadratic, hemoglobin, and suburbanization. 

To gain access to vocabulary in Tiers 2 and 3, it’s important for students to read nonfiction from either physical books or online resources, as fiction doesn’t often include these types of words. Because Tier 3 vocabulary is subject specific, our specialist teachers will make sure that students know and understand the keywords for their subject. Tier 2 vocabulary can be found across the curriculum, so it’s often the vocabulary that everyone presumes someone else will be teaching.

Inquiry-Based Resources Support Vocabulary Through Reading

School librarians not only can provide the resources that each subject needs but also can ensure, by working alongside teachers, that the topic keywords and Tier 2 vocabulary are accessible (at the right age level or appropriate for students with special needs) within those resources. Because they have an overview of the whole school, they are likely to be aware of what is being taught in various grade levels. 

School librarians have a wealth of resources through the IFLA School Library Guidelines and FOSIL (Framework of Skills for Inquiry Learning) that allow them to support teachers across the curriculum. FOSIL is a free framework that can be used worldwide and supports students from prekindergarten to 12th grade. It uses inquiry as the building block of skills that can be taught across all subjects. 

School librarians can use inquiry skills to not only teach teachers and students how to find quality resources but also support reading with purpose and understanding and so much more. Inquiry is about helping our students become high-level critical thinkers. Through supporting reading skills, we’re helping our students go beyond the list of facts to gain understanding and meaning. 

This is best done by a strong library program linked to the whole school curriculum policy, which will help teachers understand the expertise and role of the librarian within their own subject. Alongside research skills, academic reading needs to be embedded at all levels of inquiry, which means that the resources that the school librarian provides are hugely important.

Collaboration Between Teachers and Librarians is Key

Teachers and the school librarian need to work together to ensure that the resources needed are not only available but also age appropriate. This is only possible through collaboration. It’s important that the school librarian not be an afterthought in this process. If teachers need time to plan a lesson, school librarians also need planning time, and ideally this should be done together. 

Some school libraries might stock only a small number of resources. However, if given time, it’s possible to provide online and physical resources for specific lessons. Planning together will also provide the opportunity to create lessons that include the skills and appropriate keywords to engage students in academic reading with purpose. 

If teachers are unsure how to get started, they can use an initial inquiry planning form that is available via the FOSIL website and which helps teachers understand the information that school librarians need in order to be able to help them and their students. This type of planning tool can lead to some great collaboration. 

If you want to raise literacy levels at your school, include your school library and librarian. Why struggle to do this on your own if you have an expert in your school who can help? Maybe it’s time to have a conversation with your school librarian and find out how they can support academic reading across the curriculum. Finally, check to see if your school library and librarian are mentioned in your literacy policy; if not, that is also a good place to start.

Sensory Strategies That Help Students Refocus On Learning

Elementary students face a constant stream of distracting sensory stimuli throughout the day, but these simple, quick exercises can help them stay on track.

Elementary school students are constantly bombarded with sensory stimuli throughout the day, during school hours, and at home. Sensory processing plays a critical role in self-regulation and in how children function, interact, and learn at school, so it can be difficult to separate emotional regulation issues from sensory processing concerns, as they often connect.

Children who have functional sensory processing skills are able to take in sensory information, filter out what’s irrelevant, and stay relatively calm and self-regulated. They may occasionally engage in compensatory behaviors, such as biting their nails, playing with objects, getting a drink of water or going to the bathroom (when they don’t need to, for a brief respite), tapping their legs, fidgeting with their hands, and so on.

When children have difficulty processing sensory information, they can have trouble completing school- and home-based tasks that require them to sit still, attend to instruction, engage socially with peers, and play or work cooperatively with others. They have a lot of difficulty interacting with their environment and peers functionally, because they’re not receiving appropriate sensory feedback. They may engage in maladaptive behaviors—for example, they may be unable to sit in their seat and may collide with objects or peers while navigating the school setting, put objects in their mouth, and have difficulty following multistep directions (among other difficulties).

Providing young students with increased awareness of their sensory system at regular intervals throughout the day may help improve their behavior and overall self-regulation.

Simple Sensory Strategies to Improve Participation

Hug your knees: Ask your students to sit on the floor, knees up, feet firmly planted on the floor. Have them bring their knees under their chin, hugging them tightly. They can rest their chin briefly on their knees, as if they were using them as a table. This strategy integrates proprioceptive input (the ability to perceive the position and movement of the body) through joint compression (applying deep pressure).

Backwards hug: Sitting on the floor as tall as they can, students should reach both arms backwards, crossing their hands to squeeze their wrists. This strategy also integrates proprioceptive input through joint compression.

My own learning space: This is a good strategy for students who may be sensitive to auditory and/or visual inputs. When a child is having strong emotional feelings, it can often be helpful to “take space,” or move away from the challenging situation at hand (e.g., when they’re frustrated during a lesson that’s difficult to understand). This strategy allows students to take space while learning. Have an agreed-on location for this exercise. Consider creating a visual boundary to the space, such as painter’s tape, so that the student has a guide for where to go.

You may want to add sensory-blocking tools, such as noise-reducing headphones and something that blocks the student’s visual field, such as a folder standing up vertically, to further decrease sensory stimulation.

Velcro on rug spot: Consider placing Velcro around the student’s learning space, such as under the desk, on the floor, and even on their learning materials (on the back of their notebook, on their pencils, etc.). I like to alternate soft and rough textures for the added sensory stimulation. Feeling Velcro on the floor at the student’s rug spot can help them keep their eyes on you and will definitely be less distracting than having a stress ball in their hand.

Chair: Sitting on a chair with a back while listening to you can help the student focus when they’re feeling low-energy. The back support gives them the information of where their body is in a space, while their body doesn’t have to focus on trying to sit against gravity. This strategy provides tactile and proprioceptive feedback.

Floor desk: This is a small desk that provides a physical and visual boundary around the student. It can be helpful when they’re feeling high-energy. It also provides the student with a writing surface while you’re teaching. This strategy can be useful for those who benefit from increased proprioceptive and visual feedback.

Tangle/string fidget tools: These types of fidget tools are somewhat circular, so that the student can fidget with them in a repetitive and functional way, getting rid of excess energy. This tool also provides tactile feedback.

Big body breaks: Having the class stop at regular times to check in and do big body breaks so that everyone can feel just right can be very productive. Remind students that sometimes, our bodies may need to check in more often, and that’s OK. Ask your students to do downward dog/upward dog yoga poses and head-below-knee poses, and to bend down and squeeze each joint of their body, beginning at their ankles and working their way up to their shoulders.

These strategies provide a reminder to allow for increased proprioceptive (body awareness through joint compression) and/or vestibular (head below knee and rotational) inputs to ensure that students perform consistent large-movement exercises that have those components.

Cardboard box/laundry basket stuffed with pillows: This is a large, firm, and shallow cardboard box filled with a few pillows. Students should be able to sit in there, slightly squished, bringing their notebook/worksheet and a clipboard. Using this seat the right way, on the rug with their classmates, means that they are sitting up and participating. This strategy provides increased proprioceptive, visual, and tactile feedback.

The above strategies can help alleviate the sensory overload that young students experience from the continuous wave of sensory stimuli and keep them in the frame of mind for learning.

How To Promote Your Local Biz Using Social, Local And Mobile

The Web changes quickly. Only a couple of years ago, most people googled a restaurant at home before going out for dinner, while now you can just stop in the middle of the city, log in to Foursquare, find a place nearby, and perhaps even get a discount on your meal for checking in.

Marketers can now go real granular with their efforts, catching the customer here and now, and offering them a more personalized experience. In this post, I’d like to talk about how small business owners can leverage the triple power of social, mobile and local to effectively promote their venues among local Web audiences.

Begin with a Website

First thing to do is to create a website for your local biz, which you will later use to:

Provide a URL when registering in online directories;

Tie it to your social media accounts;

Create a Google Places and a Bing Local listing;

Provide for potential scaling of your small business in the future.

For unambiguous identification purposes include a crawlable company name – address – phone number somewhere on your website (for example, in the footer), so that it can be correctly associated with your other business profiles in the future.

Befriend Local Data Providers

I’m talking about such guys as Localeze (would probably be your priority), InfoGroup, Acxiom, SuperPages, YellowPages new and Insider Pages. These are pretty much a must.

They provide local business data for Facebook, Twitter, Foursquare, Google Places, Siri and a number of other services you can use to expose your local biz to online audiences. It is important to start with these directories first since they are the bottom line.

I have a friend in New York who owns several Italian food restaurants in different parts of the city. As he is keen on renaming and re-structuring his various venues (for example, splitting one business into two, or vice versa), I told him to pay attention to what versions of his businesses are listed in these data aggregators, since, even if he goes ahead and changes his contacts on, say, Google Places, his owner-submitted data may get overridden by his old directory data.

Again, while verifying/creating those listings, make sure your business information is the same in all databases. Do not use tracking phone numbers to see which directory performs best and avoid using toll-free numbers that could be associated with any location in the U.S., you’ll want to be more specific than that.

Go Social

Then create Facebook, Twitter, Foursquare and Google+ pages for your business. Now, promoting your business in these online venues is a whole different story. To get followers, you can offer points to your customers, encourage them to stay updated on deals and specials, and whatnot – just use your imagination.

To facilitate the act of following you on social networks, use QR codes in a manner they’re used in the image accompanying this post, so that your customers can just scan them and connect with you on Facebook, Twitter, etc.

Also, here are some great posts of how to engage with your customers via Facebook and Twitter:

How to Promote Your Facebook Fan Page and Get Lots of Fans

How to Get Twitter Followers

What Can You Learn from These 6 Companies That Thrive On Twitter?

Also, for smarter posting, I recommend using the now hot Buffer app, which allows you to schedule your Tweets and Facebook posts. This way, you can post with intervals and at peak times.

And, don’t forget about your brand’s integrity. Being a small biz, you may not have a marketing department to take care of your branding. So, just ask yourself what your brand’s core values are and interact with your social media accordingly.

Deals and coupons

What’s awesome about the above mentioned social networks is that users can check in to actual venues using their Foursquare, Facebook and other IDs. Upon checking-in, they can also leave tips (a-la reviews on Foursquare) and rate places.

Many vendors use coupons, specials and other ways to reward clients for checking in, and a lot of users search specifically for places that have special offers at a given moment. Groupon is probably the most popular local-friendly coupon service. Groupon offers also appear on Foursquare, and one can share Groupon deals on Facebook or Twitter.

Get rated and reviewed

Besides the main social media players, there are tons of review sites and comparison sites that your potential clients may turn to get an opinion on your business. For example, everyone knows Zagat (a famous restaurant guide) and TripAdvisor (mainly used for hotels search), but there are also tons of others.

So, how do you find review sites that apply to your niche? Well, it’s quite simple. Just search for your main niche keywords on Google Places or Bing Local and see where your competitors got their reviews from.

The relatively new kid on the block to pay attention to is Google’s Hotpot that’s built on top of Google Places, Google+ and Google Maps, including Google’s My Places, which allows one to create custom maps of places they’ve been to or are planning to visit.

Also, services like Foursquare, Google Places, InfoGroup and others let users leave feedback as well. So pay attention to that one too.

Get into Google Places and Bing Local results

Now, the tip of the iceberg. It could be hard to rank highly for certain competitive keywords on Google Places or Bing Local where the top is often dominated by big brands. However, you can aim to show up in the top ten for some less popular and thus not hugely competitive keywords, for example, for longer keyword phrases (also known as long tail keywords).

Hence, get listed on Google Places and Bing Local as well.

Important things to remember in this respect:

Uniform NAP

Remember to provide the same name/address/phone number you’ve been providing for your other virtual venues this whole time.


While creating your listings, use your niche keywords in the Description field and choose appropriate categories, which is very important. Creating a custom category for your business and stuffing it with keywords will not help (unless justified). It’s also important to use keywords in the title of the website associated with your business and somewhere in your webpage copy/ image alt text.


The more directory listings and various mentions from across the Web can be associated with your business, the higher it will show up in Google’s local search results.

Reviews and Ratings

The more reviews and ratings your business gets, the better it performs on Google Places or Bing Local. Google also estimates the general sentiment in those reviews and ratings, and takes it into account. However, I wouldn’t worry about that rankings-wise, but I would worry about it reputation-wise. Crappy reviews can turn potential customers off your biz.

*Note: If your business has more than one location, use Google’s bulk location upload instead of creating one listing.

To develop a detailed strategy on how to rank your listing higher on Google Places, give this awesome Local SEO blog by David Mihm a read.


To sum it up, Solomo does a lot of work for you these days. It lets you laser-target your promotional efforts. Plus the fact that clients can find your store on Facebook, Foursquare or other extremely mobile-friendly platforms largely spares you the need to optimize your site for mobile or develop a separate app for mobile users.

At the same time, the challenge here is to appropriately manage campaigns for multiple virtual representation of your biz online and to scale them by attracting new audiences from areas other than your own.

Pov: Plummeting Math Achievement Scores Confirm Pandemic’s Impact On Us Public School Students

POV: Plummeting Math Achievement Scores Confirm Pandemic’s Impact on US Public School Students

Photo by Greg Rosenke/Unsplash

Voices & Opinion

POV: Plummeting Math Achievement Scores Confirm Pandemic’s Impact on US Public School Students “The results strongly suggest a need to invest in strategies to offset the costs of COVID on student achievement”

The recently released scores on the National Assessment of Educational Progress (NAEP) are consistent with the widespread suspicion that the pandemic took a major toll on public school students in the United States. Although it remains difficult to distinguish clear patterns in why achievement has declined in some areas more than others, the results strongly suggest a need to invest in strategies to offset the costs of the pandemic on student achievement.

NAEP is an especially valuable tool both because of its widely recognized rigor relative to state-administered tests and because it has been administered by the US Department of Education to nationwide representative samples of students for decades and thus represents our best look at changes in student achievement over time. The main national results, released in October, show the largest decline occurred in eighth grade math, which fell by eight points compared to 2023. Math scores among fourth graders also declined—by five points—making these the lowest math achievement levels since the early 2000s. Although the drop in reading was less pronounced—at three points in both grades—they again marked the lowest levels in nearly two decades.

The state-level NAEP results, also released in October, highlight the near universal declines across the country. While some states fared slightly better than others, nearly all saw declines, especially in math. Massachusetts typically scores at or near the top of all states and remained near the top again in 2023. However, scores in Massachusetts followed national trends and dropped sharply since 2023. Math scores dropped by 6 points in fourth grade and more than 10 points in eighth grade, marking the lowest level since 2000.

While these results are worrisome, they were also predictable given patterns observed elsewhere. The NAEP Long-Term Trend Assessment is another measure of our nation’s students, typically conducted every four years. However, a special assessment conducted after just two years showed that math and reading scores dropped sharply during the pandemic. And countless other reports, either from individual states or other assessments showed substantial declines since the onset of the pandemic.

Perhaps the most troubling pattern in both the Long-Term Trend Assessment and the main fourth grade results was that achievement gaps grew. Although the gaps between high- and low-performing students had been growing before the pandemic, the large drops during the pandemic seem to have only increased those existing gaps.

Some efforts have been made to understand how COVID-era politics and policy decisions factored into learning outcomes, but the best evidence so far suggests that there’s no simple answer. For example, states that went for Trump in 2023 lost 7.2 NAEP scale score points in eighth grade math, while states that went for Biden lost 8.8 points, both of which are historic drops.

Trump states were also more likely to push for early school reopenings following the universal shutdowns in spring 2023. For example, schools in Texas reopened quickly, but still had declines in math that were in line with the national average. California, on the other hand, waited longer to reopen and saw below-average declines in several categories. In a comparison across all states, greater reliance on remote learning appears to be associated with steeper declines, but this only accounts for a small amount of the overall drop.

In other words, we shouldn’t miss the forest for the trees: the near universal declines highlight the severe and widespread challenges of the pandemic to education. Moreover, any state-by-state differences in reopening plans are also confounded with a wide range of other effects of the pandemic, complicating a clean analysis of the effects of any one policy—such as remote learning.

Overall, these results clearly show the major toll the pandemic has taken on our nation’s students, especially those who are most vulnerable. Although policies to quickly get students back in school may have played a small role in mitigating some losses, the overall conclusion is that students in nearly every corner of the country need extra assistance to get back on track. It’s reassuring that in-person schooling has resumed and learning has largely returned to pre-pandemic norms, but serious additional efforts will need to be made to successfully recover from these steep losses.

 Marcus A. Winters is a BU Wheelock College of Education & Human Development associate professor and chair of educational leadership and policy studies and Wheelock Educational Policy Center faculty director; he can be reached at [email protected]. Andrew Bacher-Hicks is a Wheelock assistant professor of educational leadership and policy studies; he can be reached at [email protected].

Explore Related Topics:

Transfer Learning Using Vgg16 In Pytorch

This article was published as a part of the Data Science Blogathon

We’re always told that “Practice makes a man perfect” and we’re made to practice tons of problems in different domains to prepare us for the doom day i.e our final exam. The more variety of problems we solve, the better we get at transferring that knowledge to solve a new problem. What if there’s a way to apply the same technique to solve classification, regression, or clustering problems.

Transfer learning is a technique by which we can use the model weights trained on standard datasets such as ImageNet to improve the efficiency of our given task.

Why transfer learning?

Before we go further into how transfer learning works, let’s look at the benefits we gain after doing transfer learning. The learning process during transfer learning is:

Fast – Normal Convolutional neural networks will take days or even weeks to train, but you can cut short the process with transfer learning.

Accurate- Generally, a Transfer learning model performs 20% better than a custom-made model.

Needs less training data- Being trained on a large dataset, the model can already detect specific features and need less training data to further improve the model.

Transfer Learning on Image Data

To demonstrate transfer learning here, I’ve chosen a simple dataset of the binary classifier which can be found here:

This data consists of two classes of cats and dogs, i.e 2.5k images for cats and 2.5k images for the dog.

VGG Architecture

There are two models available in VGG, VGG-16, and VGG-19. In this blog, we’ll be using VGG-16 to classify our dataset. VGG-16 mainly has three parts: convolution, Pooling, and fully connected layers.

Convolution layer- In this layer, filters are applied to extract features from images. The most important parameters are the size of the kernel and stride.

Pooling layer- Its function is to reduce the spatial size to reduce the number of parameters and computation in a network.

Fully Connected- These are fully connected connections to the previous layers as in a simple neural network.

Given figure shows the architecture of the model:

To perform transfer learning import a pre-trained model using PyTorch, remove the last fully connected layer or add an extra fully connected layer in the end as per your requirement(as this model gives 1000 outputs and we can customize it to give a required number of outputs) and run the model.


Preprocessing images before training is a very essential step to avoid errors. Preprocessing can resize the images to the same dimension and transform every image uniformly. different transformation tools available in torchvison.transforms is used for this process.

transform = transforms.Compose([ transforms.Resize((224, 224)), transforms.RandomHorizontalFlip(), transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.1, hue=0.1), transforms.RandomAffine(degrees=40, translate=None, scale=(1, 2), shear=15, resample=False, fillcolor=0), transforms.ToTensor(), transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)) ])

The images are loaded using ImageFolder and saved into a data loader. ImageFolder saves the images and their respective labels according to the folders they’re present in, and the dataloader divides the data into different batches for training. Here, a batch size of 8 is chosen.

Visualising the dataset

Visualising the dataset before training the data is a good practice. This can be used to make sure data is loaded properly along with their labels and transformations are applied successfully.

For this process, the images are saved in a tensor format in a grid, and labels are extracted from the dictionary.

import torchvision def imshow(inp, title=None): """Imshow for Tensor.""" inp = inp.numpy().transpose((1, 2, 0)) mean = np.array([0.485, 0.456, 0.406]) std = np.array([0.229, 0.224, 0.225]) inp = std * inp + mean inp = np.clip(inp, 0, 1) plt.imshow(inp) if title is not None: plt.title(title) plt.pause(0.001) # pause a bit so that plots are updated # Get a batch of training data inputs, classes = next(iter(trainloader)) # Make a grid from batch out = torchvision.utils.make_grid(inputs) imshow(out,title=[class_names[x] for x in classes]) Importing and training the model

The pre-trained model can be imported using Pytorch. The device can further be transferred to use GPU, which can reduce the training time.

import torchvision.models as models device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model_ft = models.vgg16(pretrained=True)

The dataset is further divided into training and validation set to avoid overfitting. Some parameters used in this model while training is as follows:

Criterion- Crossentropy loss

optimiser- Stochastic gradient descent, learning rate=0.01, momentum=0.9

Exponential Learning rate scheduler- This reduces the value of learning rate every 7 steps by a factor of gamma=0.1.

A linear fully connected layer is added in the end to converge the output to give two predicted labels.

num_ftrs = model_ft.fc.in_features # Here the size of each output sample is set to 2. # Alternatively, it can be generalized to nn.Linear(num_ftrs, len(class_names)). model_ft.fc = nn.Linear(num_ftrs, 2) #model_ft = criterion = nn.CrossEntropyLoss() # Observe that all parameters are being optimized optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9) # Decay LR by a factor of 0.1 every 7 epochs exp_lr_scheduler = lr_scheduler.StepLR(optimizer_ft, step_size=7, gamma=0.1)

These parameters can be chosen according to your own convenience and depending on the dataset.

Initially, we pass the inputs and labels to the model, and we get a predicted value of the label as an output. This predicted value and the actual value of the label are used to compute the cross-entropy loss, which is further used in backpropagation to update the value of weights and biases.

def train_model(model, criterion, optimizer, scheduler, num_epochs=25): since = time.time() best_model_wts = copy.deepcopy(model.state_dict()) best_acc = 0.0 for epoch in range(num_epochs): print('Epoch {}/{}'.format(epoch, num_epochs - 1)) print('-' * 10) # Each epoch has a training and validation phase for phase in ['train', 'val']: if phase == 'train': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode running_loss = 0.0 running_corrects = 0 # Iterate over data. for inputs, labels in trainloader: inputs = labels = # zero the parameter gradients optimizer.zero_grad() # forward # track history if only in train with torch.set_grad_enabled(phase == 'train'): outputs = model(inputs) _, preds = torch.max(outputs, 1) loss = criterion(outputs, labels) # backward + optimize only if in training phase if phase == 'train': loss.backward() optimizer.step() # statistics running_loss += loss.item() * inputs.size(0) running_corrects += torch.sum(preds == if phase == 'train': scheduler.step() epoch_loss = running_loss / dataset_sizes epoch_acc = running_corrects.double() / dataset_sizes print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # deep copy the model print() time_elapsed = time.time() - since print('Training complete in {:.0f}m {:.0f}s'.format( time_elapsed # load best model weights model.load_state_dict(best_model_wts) return model model_ft = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler, num_epochs=25)

After this step, you’ve successfully trained the model.

Thanks for reading!

The media shown in this article are not owned by Analytics Vidhya and are used at the Author’s discretion.


Update the detailed information about Using Social And Emotional Learning To Connect With Middle School Students on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!