Recherche avancée

Médias (0)

Mot : - Tags -/organisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (78)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (7482)

  • Python : ani.save very slow. Any alternatives to create videos ?

    14 novembre 2023, par Czeskleba

    Im doing some simple diffusion calculations. I save 2 matrices to 2 datasets every so many steps (every 2s or so) to a single .h5 file. After that I then load the file in another script, create some figures (2 subplots etc., see/run code - i know could be prettier). Then I use matplotlib.animation to make the animation. In the code below, in the very last lines, I then run the ani.save command from matplotlib.

    


    And that's where the problem is. The animation is created within 2 seconds, even for my longer animations (14.755 frames, done in under 2s at 8284 it/s) but after that, ani.save in line 144 takes forever (it didn't finish over night). It reserves/uses about 10gb of my RAM constantly but seemingly takes forever. If you run the code below be sure to set the frames_to_do (line 20) to something like 30 or 60 to see that it does in fact save an mp4 for shorter videos. You can set it higher to see how fast the time to save stuff increases to something unreasonable.

    


    I've been fiddling this for 2 days now and I cant figure it out. I guess my question is : Is there any way to create the video in a reasonable time like this ? Or do I need something other than animation ?

    


    You should be able to just run the code. Ill provide a diffusion_array.h5 with 140 frames so you dont have to create a dummy file, if I can figure out how to upload something like this safely. (The results are with dummy numbers for now, diffusion coefficients etc. are not right yet.)
I used dropbox. Not sure if thats allowed, if not I'll delete the link and uhh PM me or something ?

    


    https://www.dropbox.com/scl/fi/fv9stfqkm4trmt3zwtvun/diffusion_array.h5?rlkey=2oxuegnlcxq0jt6ed77rbskyu&dl=0

    


    Here is the code :

    


    import h5py
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.animation import FuncAnimation
from tqdm import tqdm
import numpy as np


# saving the .mp4 after tho takes forever

# Create an empty figure and axis
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 9), dpi=96)

# Load all saved arrays into a list
file_name = 'diffusion_array.h5'
loaded_u_arrays = []
loaded_h_arrays = []
frames_to_do = 14755  # for now like this, use # version once the slow mp4 convert is cleared up

# with h5py.File(file_name, 'r') as hf:
#     for key in hf.keys():
#         if key.startswith('u_snapshot_'):
#             loaded_u_arrays.append(hf[key][:])
#         elif key.startswith('h_snapshot_'):
#             loaded_h_arrays.append(hf[key][:])

with h5py.File(file_name, 'r') as hf:
    for i in range(frames_to_do):
        target_key1 = f'u_snapshot_{i:05d}'
        target_key2 = f'h_snapshot_{i:05d}'
        if target_key1 in hf:
            loaded_u_arrays.append(hf[target_key1][:])
        else:
            print(f'Dataset u for time step {i} not found in the file.')
        if target_key2 in hf:
            loaded_h_arrays.append(hf[target_key2][:])
        else:
            print(f'Dataset h for time step {i} not found in the file.')

# Create "empty" imshow objects
# First one
norm1 = mcolors.Normalize(vmin=140, vmax=400)
cmap1 = plt.get_cmap('hot')
cmap1.set_under('0.85')
im1 = ax1.imshow(loaded_u_arrays[0], cmap=cmap1, norm=norm1)
ax1.set_title('Diffusion Heatmap')
ax1.set_xlabel('X')
ax1.set_ylabel('Y')
cbar_ax = fig.add_axes([0.05, 0.15, 0.03, 0.7])
cbar_ax.set_xlabel('$T$ / K', labelpad=20)
fig.colorbar(im1, cax=cbar_ax)


# Second one
ax2 = plt.subplot(1, 2, 2)
norm2 = mcolors.Normalize(vmin=-0.1, vmax=5)
cmap2 = plt.get_cmap('viridis')
cmap2.set_under('0.85')
im2 = ax2.imshow(loaded_h_arrays[0], cmap=cmap2, norm=norm2)
ax2.set_title('Diffusion Hydrogen')
ax2.set_xlabel('X')
ax2.set_ylabel('Y')
cbar_ax = fig.add_axes([0.9, 0.15, 0.03, 0.7])
cbar_ax.set_xlabel('HD in ml/100g', labelpad=20)
fig.colorbar(im2, cax=cbar_ax)

# General
fig.subplots_adjust(right=0.85)
time_text = ax2.text(-15, 0.80, f'Time: {0} s', transform=plt.gca().transAxes, color='black', fontsize=20)

# Annotations
# Heat 1
marker_style = dict(marker='o', markersize=6, markerfacecolor='black', markeredgecolor='black')
ax1.scatter(*[10, 40], s=marker_style['markersize'], c=marker_style['markerfacecolor'],
            edgecolors=marker_style['markeredgecolor'])
ann_heat1 = ax1.annotate(f'Temp: {loaded_u_arrays[0][40, 10]:.0f}', xy=[10, 40], xycoords='data',
             xytext=([10, 40][0], [10, 40][1] + 48), textcoords='data',
             arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=0.3"), fontsize=12, color='black')
# Heat 2
ax1.scatter(*[140, 85], s=marker_style['markersize'], c=marker_style['markerfacecolor'],
            edgecolors=marker_style['markeredgecolor'])
ann_heat2 = ax1.annotate(f'Temp: {loaded_u_arrays[0][85, 140]:.0f}', xy=[140, 85], xycoords='data',
             xytext=([140, 85][0] + 55, [140, 85][1] + 3), textcoords='data',
             arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=0.3"), fontsize=12, color='black')

# Diffusion 1
marker_style = dict(marker='o', markersize=6, markerfacecolor='black', markeredgecolor='black')
ax2.scatter(*[10, 40], s=marker_style['markersize'], c=marker_style['markerfacecolor'],
            edgecolors=marker_style['markeredgecolor'])
ann_diff1 = ax2.annotate(f'HD: {loaded_h_arrays[0][40, 10]:.0f}', xy=[10, 40], xycoords='data',
             xytext=([10, 40][0], [10, 40][1] + 48), textcoords='data',
             arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=0.3"), fontsize=12, color='black')
# Diffusion 2
ax2.scatter(*[140, 85], s=marker_style['markersize'], c=marker_style['markerfacecolor'],
            edgecolors=marker_style['markeredgecolor'])
ann_diff2 = ax2.annotate(f'HD: {loaded_h_arrays[0][85, 140]:.0f}', xy=[140, 85], xycoords='data',
             xytext=([140, 85][0] + 55, [140, 85][1] + 3), textcoords='data',
             arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=0.3"), fontsize=12, color='black')


# Function to update the animation
def update(frame, *args):
    loaded_u_array, loaded_h_array = args

    s_per_frame = 2  # during weld/cooling you save a state every 2s
    frames_to_room_temp = 7803  # that means this many frames need to be animated
    dt_big = 87  # during "just diffusion" you save every 10 frame but 87s pass in those

    # Update the time step shown
    if frame <= frames_to_room_temp:
        im1.set_data(loaded_u_array[frame])
        im2.set_data(loaded_h_array[frame])
        time_text.set_text(f'Time: {frame * s_per_frame} s')

    else:
        im1.set_data(loaded_u_array[frame])
        im2.set_data(loaded_h_array[frame])
        calc_time = int(((2 * frames_to_room_temp) + (frame - frames_to_room_temp) * 87) / 3600)
        time_text.set_text(f'Time: {calc_time} s')

    # Annotate some points
    ann_heat1.set_text(f'Temp: {loaded_u_arrays[frame][40, 10]:.0f}')
    ann_heat2.set_text(f'Temp: {loaded_u_arrays[frame][85, 140]:.0f}')
    ann_diff1.set_text(f'HD: {loaded_h_arrays[frame][40, 10]:.0f}')
    ann_diff2.set_text(f'HD: {loaded_h_arrays[frame][85, 140]:.0f}')

    return im1, im2  # Return the updated artists


# Create the animation without displaying it
ani = FuncAnimation(fig, update, frames=frames_to_do, repeat=False, blit=True, interval=1,
                    fargs=(loaded_u_arrays, loaded_h_arrays))  # frames=len(loaded_u_arrays)

# Create the progress bar with tqdm
with tqdm(total=frames_to_do, desc='Creating Animation') as pbar:  # total=len(loaded_u_arrays)
    for i in range(frames_to_do):  # for i in range(len(loaded_u_arrays)):
        update(i, loaded_u_arrays, loaded_h_arrays)  # Manually update the frame with both datasets
        pbar.update(1)  # Update the progress bar

# Save the animation as a video file (e.g., MP4)
print("Converting to .mp4 now. This may take some time. This is normal, wait for Python to finish this process.")
ani.save('diffusion_animation.mp4', writer='ffmpeg', dpi=96, fps=60)

# Close the figure to prevent it from being displayed
plt.close(fig)



    


  • What is Audience Segmentation ? The 5 Main Types & Examples

    16 novembre 2023, par Erin — Analytics Tips

    The days of mass marketing with the same message for millions are long gone. Today, savvy marketers instead focus on delivering the most relevant message to the right person at the right time.

    They do this at scale by segmenting their audiences based on various data points. This isn’t an easy process because there are many types of audience segmentation. If you take the wrong approach, you risk delivering irrelevant messages to your audience — or breaking their trust with poor data management.

    In this article, we’ll break down the most common types of audience segmentation, share examples highlighting their usefulness and cover how you can segment campaigns without breaking data regulations.

    What is audience segmentation ?

    Audience segmentation is when you divide your audience into multiple smaller specific audiences based on various factors. The goal is to deliver a more targeted marketing message or to glean unique insights from analytics.

    It can be as broad as dividing a marketing campaign by location or as specific as separating audiences by their interests, hobbies and behaviour.

    Illustration of basic audience segmentation

    Audience segmentation inherently makes a lot of sense. Consider this : an urban office worker and a rural farmer have vastly different needs. By targeting your marketing efforts towards agriculture workers in rural areas, you’re honing in on a group more likely to be interested in farm equipment. 

    Audience segmentation has existed since the beginning of marketing. Advertisers used to select magazines and placements based on who typically read them. They would run a golf club ad in a golf magazine, not in the national newspaper.

    How narrow you can make your audience segments by leveraging multiple data points has changed.

    Why audience segmentation matters

    In a survey by McKinsey, 71% of consumers said they expected personalisation, and 76% get frustrated when a vendor doesn’t deliver.

    Illustrated statistics that show the importance of personalisation

    These numbers reflect expectations from consumers who have actively engaged with a brand — created an account, signed up for an email list or purchased a product.

    They expect you to take that data and give them relevant product recommendations — like a shoe polishing kit if you bought nice leather loafers.

    If you don’t do any sort of audience segmentation, you’re likely to frustrate your customers with post-sale campaigns. If, for example, you just send the same follow-up email to all customers, you’d damage many relationships. Some might ask : “What ? Why would you think I need that ?” Then they’d promptly opt out of your email marketing campaigns.

    To avoid that, you need to segment your audience so you can deliver relevant content at all stages of the customer journey.

    5 key types of audience segmentation

    To help you deliver the right content to the right person or identify crucial insights in analytics, you can use five types of audience segmentation : demographic, behavioural, psychographic, technographic and transactional.

    Diagram of the main types of audience segmentation

    Demographic segmentation 

    Demographic segmentation is when you segment a larger audience based on demographic data points like location, age or other factors.

    The most basic demographic segmentation factor is location, which is easy to leverage in marketing efforts. For example, geographic segmentation can use IP addresses and separate marketing efforts by country. 

    But more advanced demographic data points are becoming increasingly sensitive to handle. Especially in Europe, GDPR makes advanced demographics a more tentative subject. Using age, education level and employment to target marketing campaigns is possible. But you need to navigate this terrain thoughtfully and responsibly, ensuring meticulous adherence to privacy regulations.

    Potential data points :

    • Location
    • Age
    • Marital status
    • Income
    • Employment 
    • Education

    Example of effective demographic segmentation :

    A clothing brand targeting diverse locations needs to account for the varying weather conditions. In colder regions, showcasing winter collections or insulated clothing might resonate more with the audience. Conversely, in warmer climates, promoting lightweight or summer attire could be more effective. 

    Here are two ads run by North Face on Facebook and Instagram to different audiences to highlight different collections :

    Each collection is featured differently and uses a different approach with its copy and even the media. With social media ads, targeting people based on advanced demographics is simple enough — you can just single out the factors when making your campaign. But if you don’t want to rely on these data-mining companies, that doesn’t mean you have no options for segmentation.

    Consider allowing people to self-select their interests or preferences by incorporating a short survey within your email sign-up form. This simple addition can enhance engagement, decrease bounce rates, and ultimately improve conversion rates, offering valuable insights into audience preferences.

    This is a great way to segment ethically and without the need of data-mining companies.

    Behavioural segmentation

    Behavioural segmentation segments audiences based on their interaction with your website or app.

    You use various data points to segment your target audience based on their actions.

    Potential data points :

    • Page visits
    • Referral source
    • Clicks
    • Downloads
    • Video plays
    • Goal completion (e.g., signing up for a newsletter or purchasing a product)

    Example of using behavioural segmentation to improve campaign efficiency :

    One effective method involves using a web analytics tool such as Matomo to uncover patterns. By segmenting actions like specific clicks and downloads, pinpoint valuable trends—identifying actions that significantly enhance visitor conversions. 

    Example of a segmented behavioral analysis in Matomo

    For instance, if a case study video substantially boosts conversion rates, elevate its prominence to capitalise on this success.

    Then, you can set up a conditional CTA within the video player. Make it pop up after the user has watched the entire video. Use a specific form and sign them up to a specific segment for each case study. This way, you know the prospect’s ideal use case without surveying them.

    This is an example of behavioural segmentation that doesn’t rely on third-party cookies.

    Psychographic segmentation

    Psychographic segmentation is when you segment audiences based on your interpretation of their personality or preferences.

    Potential data points :

    • Social media patterns
    • Follows
    • Hobbies
    • Interests

    Example of effective psychographic segmentation :

    Here, Adidas segments its audience based on whether they like cycling or rugby. It makes no sense to show a rugby ad to someone who’s into cycling and vice versa. But to rugby athletes, the ad is very relevant.

    If you want to avoid social platforms, you can use surveys about hobbies and interests to segment your target audience in an ethical way.

    Technographic segmentation

    Technographic segmentation is when you single out specific parts of your audience based on which hardware or software they use.

    Potential data points :

    • Type of device used
    • Device model or brand
    • Browser used

    Example of segmenting by device type to improve user experience :

    Upon noticing a considerable influx of tablet users accessing their platform, a leading news outlet decided to optimise their tablet browsing experience. They overhauled the website interface, focusing on smoother navigation and better readability for tablet users. These changes offered tablet users a seamless and enjoyable reading experience tailored precisely to their device.

    Transactional segmentation

    Transactional segmentation is when you use your customers’ purchase history to better target your marketing message to their needs.

    When consumers prefer personalisation, they typically mean based on their actual transactions, not their social media profiles.

    Potential data points :

    • Average order value
    • Product categories purchased within X months
    • X days since the last purchase of a consumable product

    Example of effective transactional segmentation :

    A pet supply store identifies a segment of customers consistently purchasing cat food but not other pet products. They create targeted email campaigns offering discounts or loyalty rewards specifically for cat-related items to encourage repeat purchases within this segment.

    If you want to improve customer loyalty and increase revenue, the last thing you should do is send generic marketing emails. Relevant product recommendations or coupons are the best way to use transactional segmentation.

    B2B-specific : Firmographic segmentation

    Beyond the five main segmentation types, B2B marketers often use “firmographic” factors when segmenting their campaigns. It’s a way to segment campaigns that go beyond the considerations of the individual.

    Potential data points :

    • Company size
    • Number of employees
    • Company industry
    • Geographic location (office)

    Example of effective firmographic segmentation :

    Companies of different sizes won’t need the same solution — so segmenting leads by company size is one of the most common and effective examples of B2B audience segmentation.

    The difference here is that B2B campaigns are often segmented through manual research. With an account-based marketing approach, you start by researching your potential customers. You then separate the target audience into smaller segments (or even a one-to-one campaign).

    Start segmenting and analysing your audience more deeply with Matomo

    Segmentation is a great place to start if you want to level up your marketing efforts. Modern consumers expect to get relevant content, and you must give it to them.

    But doing so in a privacy-sensitive way is not always easy. You need the right approach to segment your customer base without alienating them or breaking regulations.

    That’s where Matomo comes in. Matomo champions privacy compliance while offering comprehensive insights and segmentation capabilities. With robust privacy controls and cookieless configuration, it ensures GDPR and other regulations are met, empowering data-driven decisions without compromising user privacy.

    Take advantage of our 21-day free trial to get insights that can help you improve your marketing strategy and better reach your target audience. No credit card required.

  • arm : vp9 : Add NEON loop filters

    14 novembre 2016, par Martin Storsjö
    arm : vp9 : Add NEON loop filters
    

    This work is sponsored by, and copyright, Google.

    The implementation tries to have smart handling of cases
    where no pixels need the full filtering for the 8/16 width
    filters, skipping both calculation and writeback of the
    unmodified pixels in those cases. The actual effect of this
    is hard to test with checkasm though, since it tests the
    full filtering, and the benefit depends on how many filtered
    blocks use the shortcut.

    Examples of relative speedup compared to the C version, from checkasm :
    Cortex A7 A8 A9 A53
    vp9_loop_filter_h_4_8_neon : 2.72 2.68 1.78 3.15
    vp9_loop_filter_h_8_8_neon : 2.36 2.38 1.70 2.91
    vp9_loop_filter_h_16_8_neon : 1.80 1.89 1.45 2.01
    vp9_loop_filter_h_16_16_neon : 2.81 2.78 2.18 3.16
    vp9_loop_filter_mix2_h_44_16_neon : 2.65 2.67 1.93 3.05
    vp9_loop_filter_mix2_h_48_16_neon : 2.46 2.38 1.81 2.85
    vp9_loop_filter_mix2_h_84_16_neon : 2.50 2.41 1.73 2.85
    vp9_loop_filter_mix2_h_88_16_neon : 2.77 2.66 1.96 3.23
    vp9_loop_filter_mix2_v_44_16_neon : 4.28 4.46 3.22 5.70
    vp9_loop_filter_mix2_v_48_16_neon : 3.92 4.00 3.03 5.19
    vp9_loop_filter_mix2_v_84_16_neon : 3.97 4.31 2.98 5.33
    vp9_loop_filter_mix2_v_88_16_neon : 3.91 4.19 3.06 5.18
    vp9_loop_filter_v_4_8_neon : 4.53 4.47 3.31 6.05
    vp9_loop_filter_v_8_8_neon : 3.58 3.99 2.92 5.17
    vp9_loop_filter_v_16_8_neon : 3.40 3.50 2.81 4.68
    vp9_loop_filter_v_16_16_neon : 4.66 4.41 3.74 6.02

    The speedup vs C code is around 2-6x. The numbers are quite
    inconclusive though, since the checkasm test runs multiple filterings
    on top of each other, so later rounds might end up with different
    codepaths (different decisions on which filter to apply, based
    on input pixel differences). Disabling the early-exit in the asm
    doesn’t give a fair comparison either though, since the C code
    only does the necessary calcuations for each row.

    Based on START_TIMER/STOP_TIMER wrapping around a few individual
    functions, the speedup vs C code is around 4-9x.

    This is pretty similar in runtime to the corresponding routines
    in libvpx. (This is comparing vpx_lpf_vertical_16_neon,
    vpx_lpf_horizontal_edge_8_neon and vpx_lpf_horizontal_edge_16_neon
    to vp9_loop_filter_h_16_8_neon, vp9_loop_filter_v_16_8_neon
    and vp9_loop_filter_v_16_16_neon - note that the naming of horizonal
    and vertical is flipped between the libraries.)

    In order to have stable, comparable numbers, the early exits in both
    asm versions were disabled, forcing the full filtering codepath.

    Cortex A7 A8 A9 A53
    vp9_loop_filter_h_16_8_neon : 597.2 472.0 482.4 415.0
    libvpx vpx_lpf_vertical_16_neon : 626.0 464.5 470.7 445.0
    vp9_loop_filter_v_16_8_neon : 500.2 422.5 429.7 295.0
    libvpx vpx_lpf_horizontal_edge_8_neon : 586.5 414.5 415.6 383.2
    vp9_loop_filter_v_16_16_neon : 905.0 784.7 791.5 546.0
    libvpx vpx_lpf_horizontal_edge_16_neon : 1060.2 751.7 743.5 685.2

    Our version is consistently faster on on A7 and A53, marginally slower on
    A8, and sometimes faster, sometimes slower on A9 (marginally slower in all
    three tests in this particular test run).

    This is an adapted cherry-pick from libav commit
    dd299a2d6d4d1af9528ed35a8131c35946be5973.

    Signed-off-by : Ronald S. Bultje <rsbultje@gmail.com>

    • [DH] libavcodec/arm/Makefile
    • [DH] libavcodec/arm/vp9dsp_init_arm.c
    • [DH] libavcodec/arm/vp9lpf_neon.S